Communication system, method of generating network layer address and related device
By using a method that generates network layer addresses locally at nodes, and combining publicly known information and key derivation algorithms with symmetric encryption algorithms, the latency problem of network devices in obtaining and resolving network layer addresses is solved, thereby improving connection speed and MAC address security.
Patent Information
- Application Number
- CN202210147500.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-17
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2042-02-17
AI Technical Summary
Existing network devices experience significant latency when obtaining network layer addresses and resolving MAC addresses, which affects end-to-end connection establishment and user experience.
The network layer address is generated locally at the node, and a public key is formed using public information and key derivation algorithm. The network layer address is then generated by combining the MAC address and symmetric encryption algorithm. The MAC address is then transmitted through broadcast messages within the same Layer 2 network to avoid directly transmitting the MAC address and ensure security.
It reduces network layer address acquisition and resolution latency, improves end-to-end connection establishment speed, enhances user experience, and strengthens MAC address security.
Smart Images

Figure CN116668048B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of communication, and in particular to a communication system, a network layer address generation method and related devices. BACKGROUND
[0002] Before a network device initiates a connection, the network device needs to go through address allocation, service discovery, address resolution and the like to obtain a network layer address of the network device itself and a MAC address corresponding to the network layer address. After the network device obtains the network layer address of the network device itself, a network layer address of a peer network device and the MAC address corresponding to the network layer address of the peer network device, the network device can send a network layer data packet to the peer network device in the same layer 2 network. The process of obtaining the network layer address and resolving the MAC address corresponding to the network layer address of the peer network device causes a certain time delay, which affects the establishment of an end-to-end connection and the experience of a user of the network device.
[0003] The network layer address allocation of an existing network device is mostly implemented by using a Dynamic Host Configuration Protocol (DHCP) protocol. The network device applies for a network layer address from a DHCP server by using the DHCP protocol, and the DHCP server allocates the network layer address to the network device according to the application. That is, the network device implements network layer address allocation by signaling interaction with the DHCP server. The network layer address allocation process needs two times of signaling interaction, and the time delay is large.
[0004] After obtaining the network layer address, the network device mostly uses an Address Resolution Protocol (ARP) protocol to find the MAC layer address corresponding to the network layer address. The process needs at least one time of signaling interaction, and the interaction causes an address resolution time delay. SUMMARY
[0005] Therefore, it is necessary to provide a communication system, a network layer address generation method and related devices to reduce the time delay of obtaining and resolving the network layer address, and to reduce the time delay of establishing an end-to-end connection between nodes, so as to improve the user experience.
[0006] A first aspect of an embodiment of the present application discloses a communication system, the communication system comprising at least two nodes, the at least two nodes belonging to a same layer 2 network and the at least two nodes being capable of communicating; the layer 2 network having public information, the public information being information capable of being obtained by the at least two nodes;
[0007] The node is configured to: acquire public information of the communication system; form a public key according to the public information and a preset key derivation algorithm; acquire a MAC address of the first node and form a first random number; form first plaintext data according to the MAC address and the first random number; and encrypt the first plaintext data according to the public key and a preset symmetric encryption algorithm to form a first network layer address.
[0008] According to the technical scheme, the node forms a public key according to the public information and a key derivation algorithm locally, forms a first network layer address according to the public key, a MAC address of the node and a symmetric encryption algorithm, and the first network layer address is the network layer address used by the first node to perform data transmission with other nodes. Since the network layer address can be generated in the first node, compared with the generation process of the network layer address according to the DHCP protocol and the APR protocol, the interaction of signaling between nodes is reduced, the time delay cost of the node to acquire the network layer address and the time delay of the node to analyze the network layer address to acquire the corresponding MAC address are reduced, and the time delay of the node to establish an end-to-end connection is reduced, thereby improving the user experience.
[0009] Further, the public information can be acquired by all nodes of the communication system, that is, each node can generate a corresponding network address by using the public information and the MAC address of the node, and the association between the MAC address of each node and the network address is established. In the transmission process of the network layer address, since the MAC address is in an encrypted state, other nodes of the second layer network cannot acquire the corresponding MAC address through the network layer address, and the security of the MAC address is ensured.
[0010] In some embodiments, the communication system further includes a subnet center, and the subnet center is configured to: send a first broadcast message to the at least two nodes, the first broadcast message carrying a MAC address of the subnet center; and the at least two nodes are configured to: receive the first broadcast message sent by the subnet center, and set the MAC address of the subnet center as the public information.
[0011] According to the technical scheme, the nodes in the same second layer network can acquire the broadcast message, and the MAC address in the broadcast message can be set as the public information.
[0012] In some embodiments, the nodes in the same second layer network can directly communicate with each other, and the nodes in the same second layer network can also communicate through the subnet center.
[0013] Optionally, in other embodiments, the public information can also be other fields, for example, a random number sent by the subnet center through the broadcast message, as long as the public information can be acquired by all nodes in the same second layer network.
[0014] In some embodiments, the subnet center is further configured to: form a second random number; send a second broadcast message carrying the second random number to the at least two nodes; the node is further configured to: receive the second broadcast message sent by the subnet center, parse the second broadcast message to obtain the second random number and set the second random number as a salt value of the key derivation algorithm; form a public key according to the public information, the salt value and the key derivation algorithm.
[0015] By using the technical scheme, the subnet center forms a random number as a salt value of the key derivation algorithm, so that the key formed by the key derivation algorithm is different each time, and the security of the public key is improved.
[0016] In some embodiments, the first node is further configured to: obtain routing table information, the routing table information including a globally unique identifier of the at least two nodes and a target network layer address corresponding to the globally unique identifier; if the routing table includes a target network layer address identical to the first network layer address, the node is further configured to: form a third random number; form second plaintext data according to the MAC address of the node and the third random number; and encrypt the second plaintext data according to the public key and a preset symmetric encryption algorithm to form a second network layer address.
[0017] By using the technical scheme, whether the routing table information includes a network layer address identical to the first node is checked, and if yes, the network layer address is updated to avoid address conflict of nodes in the same layer 2 network.
[0018] In some embodiments, the node is configured to: obtain public information of the communication system; form a public key according to the public information and the key derivation algorithm; obtain a first network layer address of the node; and decrypt the first network layer address according to the public key and a preset symmetric encryption algorithm to obtain a MAC address of the node.
[0019] By using the technical scheme, other nodes receiving the network layer address can obtain the MAC address of the node according to the decrypted network layer address of the node, so that direct transmission of the MAC address between nodes is avoided, and the security of the MAC address is improved.
[0020] In some embodiments, the node is further configured to: form a correspondence between the MAC address and the first network layer address.
[0021] By using the technical scheme, the correspondence between the MAC address and the network layer address is established, and the MAC address is not decrypted again when data is transmitted between nodes next time, so that the data transmission efficiency is improved.
[0022] In some embodiments, the node is further configured to determine a target node among the at least two nodes as a master node, and obtain a MAC address of the second node and set the MAC address of the target node as the public information.
[0023] With the technical solution, for a communication system in which nodes are directly connected, a master node is determined among the at least two nodes, and the MAC address of the master node is set as the public information.
[0024] In some embodiments, if the target node is a communication initiator, the node is further configured to determine the target node as the master node according to that the target node is the communication initiator.
[0025] With the technical solution, the node of the communication initiator in the communication system in which nodes are directly connected is set as the master node, which is convenient for identification and confirmation.
[0026] In some embodiments, the subnet center is a WiFi wireless access point, and the at least two nodes are all stations.
[0027] The second aspect provides a method for generating a network layer address, applied to a node, the node belonging to a layer 2 network, the layer 2 network having public information, and all nodes of the layer 2 network being able to obtain the public information; the method comprising: obtaining the public information; forming a public key according to the public information and a preset key derivation algorithm; obtaining a MAC address of the node and forming a first random number; forming first plaintext data according to the MAC address of the node and the first random number; and encrypting the first plaintext data according to the public key and a preset symmetric encryption algorithm to form a first network layer address.
[0028] In some embodiments, the node communicates with other nodes through a subnet center, and the obtaining of the public information comprises: receiving a first broadcast message sent by the subnet center, and setting a MAC address of the subnet center as the public information.
[0029] In some embodiments, the forming of the public key according to the public information and the preset key derivation algorithm comprises: receiving a second broadcast message sent by the subnet center, the second broadcast message carrying a second random number formed by the subnet center; setting the second random number as a salt value of the key derivation algorithm; and forming the public key according to the public information, the salt value and the key derivation algorithm.
[0030] In some embodiments, the method further comprises: obtaining routing table information, the routing table information comprising a globally unique identifier of a target node in the at least two nodes and a network layer address corresponding to the globally unique identifier; forming a third random number if there is a network layer address same as the first network layer address in the routing table; forming second plaintext data according to the MAC address of the node and the third random number; and encrypting the second plaintext data according to the public key and the symmetric encryption algorithm to form a second network layer address.
[0031] In some embodiments, the two-layer network further comprises at least one node, and the method further comprises: obtaining a third network layer address of a second node in the at least one node; and decrypting the third network layer address according to the public key and the symmetric encryption algorithm to obtain the MAC address of the target node.
[0032] In some embodiments, the method further comprises: forming a correspondence between the MAC address and the first network layer address.
[0033] In some embodiments, the obtaining of the public information comprises: determining that the target node is a master node; and obtaining the MAC address of the second node and setting the MAC address of the second node as the public information.
[0034] In some embodiments, if the target node is a communication initiator, the determining that the target node is a master node comprises: determining that the target node is a master node according to that the target node is a communication initiator.
[0035] A third aspect provides a computer readable storage medium, which stores computer instructions, when the computer instructions run on an electronic device, cause the electronic device to perform the method of the second aspect.
[0036] A fourth aspect provides an electronic device, which comprises a processor and a memory, the memory is configured to store instructions, and the processor is configured to invoke the instructions in the memory, so that the electronic device performs the method of any one of the second aspect.
[0037] A fifth aspect provides a chip, which is coupled with a memory in an electronic device, and the chip is configured to control the electronic device to perform the method of the second aspect.
[0038] It can be understood that the method of the second aspect, the computer readable storage medium of the third aspect, the electronic device of the fourth aspect, and the chip of the fifth aspect correspond to the method of the first aspect, and thus the beneficial effects achieved by the above-mentioned aspects can refer to the beneficial effects of the corresponding method, which will not be described here again. BRIEF DESCRIPTION OF DRAWINGS
[0039] Figure 1 An architecture diagram of a communication system according to an embodiment of the present application is provided.
[0040] Figure 2 A method for generating a network layer address according to an embodiment of the present application is provided.
[0041] Figure 3 An architecture diagram of a communication system according to another embodiment of the present application is provided.
[0042] Figure 4 A method for generating a network layer address according to another embodiment of the present application is provided.
[0043] Figure 5 A method for generating a network layer address according to another embodiment of the present application is provided.
[0044] Figure 6 An architecture diagram of an electronic device according to an embodiment of the present application is provided. DETAILED DESCRIPTION
[0045] It should be noted that, in the present application, "at least one" means one or more, and "multiple" means two or more than two. The "and / or" describes the association between the associated objects, which means that there can be three kinds of relationships, for example, A and / or B can represent the following three cases: A exists alone, A and B exist together, B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth" and the like (if any) in the specification and claims of the present application and the drawings are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0046] In the embodiments of the present application, the words "exemplary" or "for example" are used to mean serving as an example, instance, or illustration. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Rather, the use of the words "exemplary" or "for example" is intended to present related concepts in a concrete manner.
[0047] For ease of understanding, some exemplary explanations of concepts related to the embodiments of the present application are provided for reference.
[0048] I. Node
[0049] A node is an electronic device with data transceiving capability. For example, the node can be a Cockpit Domain device, or one of the modules in the Cockpit Domain device (e.g., one or more of the cockpit domain controller (CDC), camera, screen, microphone, audio, electronic key, keyless entry or start system controller, etc.). In implementation, the node can also be a data relay device, such as a router, repeater, bridge or switch; a terminal device, such as various types of user equipment (UE), mobile phone, pad, desktop computer, earphone, audio, etc.; a machine intelligence device, such as a self-driving device, transportation safety device, virtual reality (VR) terminal device, augmented reality (AR) terminal device, machine type communication (MTC) device, industrial control device, remote medical device, smart grid device, smart city device; a wearable device (e.g., smart watch, smart bracelet, pedometer, etc.); and the like. In some technical scenarios, devices with similar data transceiving capability can not be referred to as nodes, but for the convenience of description, electronic devices with data transceiving capability are collectively referred to as nodes in the embodiments of the present application.
[0050] II. Key derivation
[0051] Key derivation is a process of deriving one or more secret values from a secret value, and the algorithm used to derive the key is called key derivation function (KDF), also known as key derivation algorithm. For example, a new secret value DK derived from a secret value Key can be expressed as: DK = KDF(Key).
[0052] Commonly used key derivation algorithms include a password-based key derivation function (PBKDF), a scrypt algorithm, and the like. Among them, the PBKDF algorithm includes a first-generation PBKDF1 and a second-generation PBKDF2. Optionally, in specific implementation, a hash algorithm can be used to hash the input secret value in the key derivation process, and therefore the KDF can also receive an algorithm identifier as input, for indicating which hash algorithm to use.
[0053] Three, layer 2 network
[0054] In a communication system, a layer 2 network refers to a network that uses a media access control (MAC) address to address and forward a packet, which can be a virtual local area network (VLAN), a virtual extensible LAN (VXLAN), a data link layer network, and the like.
[0055] The system architecture and business scenarios of the embodiments of the present application are described below. It should be noted that the system architecture and business scenarios described in the present application are for more clearly illustrating the technical solutions of the present application, and do not constitute a limitation on the technical solutions provided by the present application. Those skilled in the art can know that, with the evolution of system architecture and the appearance of new business scenarios, the technical solutions provided by the present application are also applicable to similar technical problems.
[0056] Please refer to Figure 1 , Figure 1Figure 1 is a schematic diagram of an architecture of a communication system 100 according to an embodiment of the present application. The communication system 100 comprises a first node 10 and a second node 20. The first node 10 and the second node 20 belong to the same layer 2 network. The first node 10 can be requested to associate with the second node 20. After the association is successful, the first node 10 can communicate with the second node 20 via a data link. Optionally, the data link via which the first node 10 communicates with the second node 20 can comprise various types of connection media, such as short-range connection technologies or long-range connection technologies. The short-range connection technologies can include, but are not limited to, 802.11b / g, Bluetooth, Zigbee, Radio Frequency Identification (RFID), Ultra Wideband (UWB), etc. The long-range connection technologies can include, but are not limited to, Global System for Mobile communications (GSM), General Packet Radio Service (GPRS), Universal Mobile Telecommunications System (UMTS), etc. Of course, other technologies can also be used to support the communication between the first node 10 and the second node 20, which are not limited herein.
[0057] In addition, the first node 10 and the second node 20 can be the same type of device. For example, the first node 10 and the second node 20 can both be mobile terminals. The first node 10 and the second node 20 can also be different types of devices. For example, the first node 10 can be a mobile terminal, and the second node 20 can be a switch.
[0058] In the embodiment, the first node 10 and the second node 20 are both mobile terminals. Figure 1 In the embodiment, the communication system 100 only comprises two nodes: the first node 10 and the second node 20. It can be understood that in other embodiments, the number of the first node 10 or the second node 20 is more than one, for example, the number of the second node 20 is 2, 3, 4, or more than 4, and each of the second nodes 20 can communicate with the first node 10.
[0059] Optionally, the first node 10 can be a master node, and the second node 20 can be a slave node.
[0060] Optionally, if the first node 10 can be the initiator of the communication, it can be referred to as a master node, and correspondingly, if the second node 20 can be the receiver of the communication, it can be referred to as a slave node. It can be understood that in other embodiments, the master node and the slave node in the communication system 100 can be determined in other manners.
[0061] wherein each of the two-layer networks has a public information which can be acquired by all nodes in the two-layer network, wherein the public information can be a MAC address of one of the nodes, and of course, the public information can also be other identification information of the node, such as a node identifier, as long as it can be acquired by other nodes in the same two-layer network.
[0062] Referring to Figure 2 A network layer address generation method is provided in the present application, which can be applied in Figure 1 the communication system 100 as shown in the figure. The method comprises:
[0063] 21. The first node 10 acquires the public information.
[0064] wherein the method can acquire the public information of the two-layer network by the first node 10.
[0065] wherein the first node 10 and the second node 20 in the same two-layer network can determine the master node when establishing the association relationship, and the public information can be the identification information of the master node. The identification information can be the MAC address of the master node. Of course, the identification information can also be other information, such as the universally unique identifier (UUID) of the master node.
[0066] Exemplarily, before acquiring the public information, the method further comprises:
[0067] setting the master node according to the types of the first node 10 and the second node 20, and setting the MAC address of the master node as the public information.
[0068] Specifically, in some embodiments, if the first node 10 and the second node 20 are devices of the same type, such as mobile terminals or switches, the node which initiates the request for association or the request for communication can be set as the master node, and the MAC address of the master node can be set as the public information. For example, the first node 10 sends a Bluetooth establishment request to the second node 20, and successfully establishes the Bluetooth connection between the first node 10 and the second node 20, then the first node 10 can be set as the master node, the second node 20 can be set as the slave node, and the MAC address of the first node 10 can be set as the public information. In this way, the first node 10 can acquire the public information.
[0069] In some other embodiments, if the first node 10 and the second node 20 are different types of devices, for example, the first node 10 is a mobile terminal and the second node 20 is a switch, the second node 20 (for example, the switch) is set as the master node, and the MAC address of the second node 20 is set as the public information. In this way, the public information can be obtained by the second node 10.
[0070] 22a. The first node 10 generates the public key.
[0071] Specifically, the first node 10 generates the public key according to the public information and by invoking a preset key derivation algorithm.
[0072] The formula for generating the public key is:
[0073] key = KDF (password = subnet_identifier, salt);
[0074] wherein key is the public key, KDF() is the key derivation algorithm, subnet_identifier is the public information, and salt is an input parameter of the key derivation algorithm: a salt value. That is, the public information and the salt value are input into the key derivation algorithm so that the key derivation algorithm outputs the corresponding public key key.
[0075] Optionally, the salt value can be a random number generated by the master node of the communication system 100, and the random number is sent to the slave node after the association between the slave node and the master node is successful.
[0076] Of course, in other embodiments, the salt value can also be a fixed value preset in each node. For example, the preset salt value is "1101", and each node of the communication system 100 stores the salt value "1101" and uses the salt value to calculate the public key when invoking the corresponding key derivation algorithm.
[0077] 22b. The second node 20 generates the public key.
[0078] Specifically, the second node 20 generates the public key according to the public information and by invoking a preset key derivation algorithm.
[0079] The method for the second node 20 to generate the public key is the same as the method of the first node 10 in step 22a, which will not be described here.
[0080] 23. The first node 10 generates the network layer address.
[0081] Specifically, step 23 specifically includes:
[0082] The first node 10 obtains the local MAC address and generates a random number;
[0083] The first node 10 constructs the plaintext data according to the MAC address and the random number;
[0084] The first node 10 calls a preset symmetric encryption algorithm, takes the plaintext data and a public key as input parameters of the symmetric encryption algorithm, and forms encrypted data of the plaintext data;
[0085] The first node 10 forms the network layer address according to the encrypted data.
[0086] The local MAC address is the MAC address of the first node 10.
[0087] Optionally, the first node 10 can generate the random number according to a preset pseudo-random function.
[0088] It can be understood that there are various ways to construct the plaintext data. For example, a 16-bit random number is spliced after the MAC address. For example, if the MAC address is 22CCD848CE53 and the random number is CC, the plaintext data is formed as 22CCD848CE53CC. Of course, the random number can also be placed before or in the middle of the MAC address, and the application does not limit the construction method of the plaintext data.
[0089] It can be understood that the encryption formula of the plaintext data is:
[0090] Address = symmetric_crypt(plaintext data, key, ENCRYPT);
[0091] The Address is the network layer address, symmetric_crypt() is a preset symmetric encryption algorithm, the key is a public key, and ENCRYPT is an encryption identifier.
[0092] Specifically, the public key is taken as a key of the symmetric encryption algorithm, the plaintext data is encrypted by calling the preset symmetric encryption algorithm, and the symmetric encryption algorithm outputs the encrypted data, which is the network layer address.
[0093] Of course, in other embodiments, the encrypted data can be further processed, for example, a random number is added, reordering is performed, and the network layer address is formed through further processing.
[0094] In this way, the first node 10 of the communication system 100 derives the public key through the public information and the preset key derivation algorithm, and generates the network layer address of the first node 10 through the public key, the MAC address of the master node and the preset encryption algorithm. Since the generation of the network layer address is completed only in the first node 10, the signaling interaction between the first node 10 and other nodes is not required, and the time delay cost of the nodes to obtain the network layer address is reduced.
[0095] Further, the first node 10 generates the network layer address by itself, which can realize the allocation-free and resolution-free of the network layer address, and further reduce the time delay caused by the use of the network layer address. Since the network layer address is generated based on the MAC address of the node, the MAC address is encrypted by the encryption algorithm to form the network layer address, which prevents the MAC address from being leaked and enhances the security of the MAC address. The plaintext data is constructed by the MAC address and the random number, and the random number is introduced to improve the randomness of the plaintext data. Since the MAC address is unique, the network layer address formed thereby can prevent the conflict.
[0096] Please refer again to Figure 2 After the network layer address is generated, the method further includes:
[0097] The second node 20 sends an address request message to the first node 10.
[0098] The first node 10 sends an address response message corresponding to the address request message to the second node 20, and the address response message carries the network layer address of the first node 10.
[0099] That is, the second node 20 obtains the network layer address of the first node 10 by sending an address request message to the first node 10.
[0100] It can be understood that in other embodiments, the second node 20 can also obtain the network layer address of the first node 10 in other ways. For example, the second node 20 can obtain the network layer address of the first node 10 by domain name resolution.
[0101] After the second node 20 obtains the network layer address of the first node 10, the method further includes:
[0102] 24. The second node 20 inversely resolves the MAC address in the network layer address.
[0103] Specifically, the second node 20 decrypts the network layer address by taking the public key generated in step 22b and the obtained network layer address as inputs of the symmetric encryption algorithm, to obtain the plaintext data.
[0104] Then the MAC address in the plaintext data is extracted.
[0105] Among them, the symmetric encryption algorithm stored in all nodes in the same layer two network is the same, that is, it can be the same kind of symmetric encryption algorithm.
[0106] Specifically, the decryption formula of the network layer address is as follows:
[0107] Plaintext data = symmetric_crypt(Address, key, DECRYPT);
[0108] Wherein, Address is a network layer address, symmetric_crypt() is a preset symmetric encryption algorithm, used for decrypting the network layer address to obtain plaintext data; key is a public key, and DECRYPT is a decryption identifier.
[0109] Specifically, the second node 20 decrypts the network layer address by calling the symmetric encryption algorithm with the network layer address as the input of the symmetric encryption algorithm and the public key as the decryption key of the symmetric encryption algorithm, and outputs the decrypted data, which is the plaintext data.
[0110] Wherein, the formula for extracting the MAC address from the plaintext data is as follows:
[0111] MAC = GetBits (plaintext data, 0-48);
[0112] Wherein, MAC is the extracted MAC address; GetBits() is an extraction function, used for extracting 48-bit data in the plaintext data, which is the MAC address.
[0113] Of course, in other embodiments, the extraction function can set a corresponding extraction mode according to the arrangement mode of the MAC address and the random number in the plaintext data, and the application does not limit the extraction mode of the MAC address.
[0114] In this way, when the first node 10 in the communication system 100 generates a network layer address, other nodes (such as the second node 20) in the communication system 100 can decrypt the network layer address of the first node 10 according to the public key and the preset corresponding encryption algorithm to obtain the MAC address of the first node.
[0115] In some embodiments, the second node 20 is further configured to form a corresponding relationship between the MAC address of the first node and the network layer address, and store the corresponding relationship in the second node 20. In this way, when the second node 20 and the first node 10 perform data transmission again, the second node 20 does not need to obtain the corresponding MAC address by decrypting the network layer address of the first node 10, but only needs to find the stored corresponding relationship according to the obtained network layer address to obtain the corresponding MAC address.
[0116] As shown in FIG. 1, in some embodiments, the method further comprises: Figure 2
[0117] The first node 10 obtains routing table information, which can be obtained by the first node from other nodes, wherein the routing table information includes the node identifier of the node and the network layer address corresponding to the node identifier. Wherein, the node identifier can be a Universally Unique Identifier (UUID).
[0118] After the first node 10 generates the network layer address, the first node 10 determines whether the network layer address is the same as the network layer addresses of other nodes in the routing table.
[0119] If there is no network layer address in the routing table that is the same as the network layer address of the first node 10, the generated network layer address is determined to be the network layer address of the first node 10. If there is a network layer address in the routing table information that is the same as the network layer address generated by the first node 10, the first node 10 performs a network layer address update. In this way, the routing table information is used to check for network layer address conflicts, so as to avoid network layer address conflicts among all nodes in the same layer 2 network.
[0120] Specifically, the network layer address update performed by the first node 10 includes:
[0121] generating a new random number and forming new plaintext data based on the MAC address of the first node 10 and the new random number;
[0122] encrypting the new plaintext data using a preset encryption algorithm and a public key to form a new network layer address.
[0123] It should be understood that the first node 10 can also update the updated network layer address to other nodes through a routing update process.
[0124] Referring to Figure 3 Another architecture of a communication system 100 is provided in the embodiments of the present application, and the communication system 100 includes a first node 10, a second node 20, and a subnet center 30. The first node 10 can communicate with the second node 20 through the subnet center 30, and the first node 10 and the second node 20 belong to the same layer 2 network.
[0125] Of course, in other embodiments, the first node 10 can directly communicate with the second node 20.
[0126] Optionally, the data link used by the first node 10 to communicate with the second node 20 can include various types of connection media, such as short-range connection technologies including 802.11b / g, Radio Frequency Identification (RFID), Ultra Wideband (UWB), and the like. Of course, other technologies can also be used to support communication between the first node 10 and the second node 20, which are not limited herein.
[0127] Alternatively, the first node 10 and the second node 20 can be the same type of device. For example, both the first node 10 and the second node 20 can be mobile terminals; the first node 10 and the second node 20 can also be different types of devices. For example, the first node 10 can be a mobile terminal, and the second node 20 can be an access point.
[0128] In this embodiment, the known information can be the MAC address of the subnet center 30. Of course, the known information can also be other information generated by the subnet center, such as the identification information of the subnet center 30 or the random number generated by the subnet center 30. As long as the subnet center 30 can send the information to other nodes and it can be obtained by all nodes in the Layer 2 network, it is acceptable.
[0129] Please see Figure 4 This application provides a method for generating network layer addresses, which is applied to... Figure 3 The communication system 100 shown.
[0130] in, Figure 4 The method for generating network layer addresses provided in [the document] is similar to... Figure 2 The methods provided are similar, with each node generating its own network layer address locally. The difference lies in how publicly known information is obtained.
[0131] Specifically, in this embodiment, the subnet center 30 is a WiFi wireless access point (AP), such as a wireless router. The first node 10 and the second node 20 are both stations (STAs), for example, the first node 10 is STA1 and the second node 20 is STA2. Of course, in other embodiments, the subnet center 30, the first node 10, and the second node 20 can be implemented in other ways.
[0132] like Figure 4 As shown, the specific steps of the network layer address generation method in this embodiment are as follows:
[0133] 41. STA1 and STA2 obtain publicly known information.
[0134] Specifically, the WiFi AP periodically broadcasts beacon frames containing BSSID (Basic Service Set Identifier) information, the value of which is the MAC address of the WiFi AP. STA1 and STA2 receive the beacon frames, parse the BSSID in the beacon frames, and treat the BSSID as publicly known information.
[0135] Specifically, the subnet center 30 sends the public information to the first node 10 and the second node 20 by sending a broadcast message carrying the public information to the first node 10 and the second node 20, and the first node 10 and the second node 20 receive and parse the broadcast message to obtain the public information.
[0136] In the embodiment, the public information is the MAC address of the subnet center 30, and in other embodiments, the public information can be a random number generated by the subnet center 30 or other identification information of the subnet center 30.
[0137] 42. The STA1 and the STA2 generate the public key.
[0138] Specifically, the STA1 and the STA2 generate the public key according to the public information and a preset key derivation algorithm.
[0139] In an embodiment, the formula for the STA1 and the STA2 to generate the public key is as follows:
[0140] key = PBKDF2 (PRF = HMAC, password = BSSID, salt = "New IP", C = 1000, dklen = 128);
[0141] In the formula, the key derivation algorithm is PBKDF2(), and the string "New IP" is set as the salt value salt and the same salt value is used by all nodes. In this way, the STA1 and the STA2 take the public information and the salt value as the input of the key derivation algorithm PBKDF2, and the key derivation algorithm outputs the public key.
[0142] In some embodiments, the STA1 and the STA2 can also set the iteration number c of the key derivation algorithm and the length of the key, and in the embodiment, the iteration number is set to 1000 times and the length of the key is 128 bits. Of course, in other embodiments, the corresponding iteration number or the length of the key can be set according to actual needs, and the present application does not limit this.
[0143] In other embodiments, the subnet center 30 generates a random number and sends the random number to the first node 10 and the second node 20 by sending a broadcast message carrying the random number to the first node 10 and the second node 20, and the first node 10 and the second node 20 receive and parse the broadcast message to obtain the random number and take the random number as the salt value of the key derivation algorithm. That is, the salt value of the key derivation algorithm can be a preset fixed value in each node or a random number sent by the subnet center 30 to each node through the broadcast message.
[0144] 43. The STA2 generates the network layer address.
[0145] In particular, the STA2 generates a random number, forms plaintext data according to the random number and the MAC address of the STA2, and encrypts the plaintext data by using a symmetric encryption algorithm and a public key to form ciphertext data, which is the network layer address.
[0146] In an embodiment, the STA2 forms the plaintext data according to the following formula:
[0147] plaintext data = strcat(MAC, (unit16) random());
[0148] wherein MAC is the MAC address of the STA2, and random() is a random function for generating a 16-bit random number.
[0149] In the embodiment, the STA2 uses HMAC as a pseudo-random function. A 16-bit random number is generated by using HMAC, and 64-bit plaintext data is generated by concatenating the 16-bit random number after the MAC address of the STA2.
[0150] In an embodiment, the STA2 encrypts the plaintext data according to the following encryption formula:
[0151] Address = blowfish(plaintext data, key, ENCRYPT);
[0152] wherein Address is the encrypted data, blowfish is a symmetric encryption algorithm, key is a public key, and ENCRYPT is an encryption identifier.
[0153] In particular, the STA2 calls the symmetric encryption algorithm blowfish, takes the plaintext data and the public key as inputs, sets the blowfish mode to the encryption mode to encrypt the plaintext data, and generates 64-bit ciphertext data, which is the network layer address.
[0154] Thus, the network layer address generation method provided in the embodiment generates the network layer address of each node in the node, and analyzes the network layer address in the node, without message interaction with other nodes, thereby reducing the time delay of network layer address allocation. Moreover, the MAC address of the node is not exposed in the network layer address, and only the nodes in the same layer-2 network can inversely analyze the MAC address of other nodes; the nodes not in the same layer-2 network cannot generate the public key due to the inability to obtain the corresponding public information, and thus cannot obtain the MAC address according to the network layer address, thereby achieving the purpose of protecting the node privacy.
[0155] Further, the network layer address generation method provided by the application is applicable to nodes in the same layer 2 network, and the network layer address of other nodes is decrypted by using a public key to obtain the corresponding MAC address. Compared with the existing ARP protocol, the network layer address generation method provided by the application does not need protocol interaction, and reduces the address resolution delay.
[0156] 44. STA1 inversely resolves the MAC address.
[0157] Specifically, after the STA1 obtains the network layer address of the STA2, the network layer address is decrypted by using a symmetric encryption algorithm and a public key to obtain plaintext data; and then the MAC address in the plaintext data is extracted.
[0158] In an embodiment, the decryption formula of the encrypted data of the STA1 is as follows:
[0159] Plaintext data = blowfish (Address, key, DECRYPT);
[0160] Wherein, Address is encrypted data, blowfish is a symmetric encryption algorithm, key is a public key, and DECRYPT is a decryption identifier.
[0161] Specifically, it is determined that the symmetric encryption algorithm corresponding to the STA2 is blowfish, the STA1 calls the blowfish algorithm, takes the network layer address and the public key as the input of the blowfish algorithm, sets the blowfish mode to the decryption mode, and the blowfish algorithm outputs 64-bit plaintext data. Then the STA1 intercepts the first 48 bits of the plaintext data to obtain the MAC address of the STA2.
[0162] After the other nodes obtain the network layer address of the node, the network layer address can be decrypted by using a local public key to obtain the MAC address corresponding to the network, so that the MAC address between nodes can be transmitted through the network layer address. Since the plaintext data formed by the MAC address and the random number is encrypted by the encryption algorithm in the network layer address transmission process, the MAC address is not directly exposed, so as to improve the security of the MAC address transmission.
[0163] In some embodiments, the STA1 or the STA2 is further configured to acquire routing table information, the routing table information comprising a globally unique identifier of the at least two nodes and a target network layer address corresponding to the globally unique identifier; if the routing table comprises a target network layer address identical to the network layer address generated by the STA1 or the STA2, the first node is further configured to generate a random number; form new plaintext data based on the local MAC address and the random number; encrypt the new plaintext data based on a public key and a preset symmetric encryption algorithm to form a new network layer address. In this way, the routing table information is used to check whether the network layer address generated by a node is identical to the network layer address of other nodes, and if the network layer address generated by the node is identical to the network layer address of other nodes, the node generates a new random number to update the network layer address.
[0164] Further, the STA1 or the STA2 is further configured to form a correspondence between the MAC address and the network layer address of other nodes.
[0165] Further, if Figure 4 The network layer address generated by the node is an IPv6 link-local address. The method further comprises:
[0166] Each node forms an IPv6 link-local address in advance, and forms ciphertext data as the low 64 bits of the IPv6 link-local address. The high 64 bits and the low 64 bits of the IPv6 link-local address are combined to form the completed ciphertext data, i.e., the IPv6 link-local address.
[0167] Specifically, please refer to Figure 5 The method for generating the IPv6 link-local address comprises:
[0168] (1) The first node 10 or the second node 20 determines the high 64 bits of the IPv6 link-local address;
[0169] In this embodiment, the high 64 bits of the IPv6 Link Local address of each node are 0xFE80000000000000. Of course, in other embodiments, the high 64 bits of the IPv6 Link Local address can be set to a corresponding value in an actual scenario and stored in the corresponding node, and of course, the high 64 bits of the IPv6 Link Local address can also be broadcast to each node by the subnet center through a broadcast or other technology, as long as the values of the high 64 bits of the IPv6 Link Local address set in each node in the same layer 2 network of the communication system are the same.
[0170] (2) Obtain public information;
[0171] In this embodiment, the public information is the MAC address of the switch. The switch sends a broadcast message to the first node 10 and the second node 20, and the broadcast message carries the MAC address of the switch; the first node 10 and the second node 20 receive the broadcast message, parse the broadcast message to obtain the MAC address, and set the MAC address as the public information.
[0172] (3) Generate the low 64 bits of the IPv6 Link Local address;
[0173] Specifically, the first node 10 or the second node 20 generates a public key according to the public information and a preset key derivation algorithm; obtains a local MAC address, generates a 16-bit random number, forms plaintext data according to the local MAC address and the random number; calls a preset symmetric encryption algorithm (such as a blowfish algorithm), and encrypts the plaintext data by taking the public key as an encryption key to obtain ciphertext data, which is the low 64 bits of the IPv6 Link Local address.
[0174] (4) Concatenate the high 64 bits of the IPv6 Link Local address and the low 64 bits of the IPv6 Link Local address in order to generate a 128-bit IPv6 Link Local address, which is the network layer address.
[0175] It can be understood that the above execution sequence is only one embodiment provided by the present application, and in other embodiments, step (1) can be executed simultaneously with step (3), and of course, step (1) can also be executed after step (3).
[0176] Figure 6A structural diagram of an electronic device 60 is shown. The electronic device 60 can be the first node or the second node described above, and can be used to perform the functions of the nodes of the above-described embodiments.
[0177] The electronic device 60 can include a processor 110, an external memory interface 120, an internal memory 121, a communication module 130, an audio module 140, a sensor module 150, a display screen 160, and the like.
[0178] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 60. In other embodiments of the present application, the electronic device 60 can include more or fewer components than shown, or combine certain components, or split certain components, or different arrangement of components. The components shown can be implemented in hardware, software, or a combination of software and hardware.
[0179] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices, or can be integrated in one or more processors.
[0180] The processor can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching instructions and executing instructions.
[0181] The memory in the processor 110 can also be provided for storing instructions and data. In some embodiments, the memory in the processor 110 can be a cache memory. The memory can store instructions or data that have been used or used frequently by the processor 110. If the processor 110 needs to use the instructions or data, it can directly call from the memory. Avoiding repeated access, reducing the waiting time of the processor 110, thus improving the efficiency of the system.
[0182] In some embodiments, the processor 110 can include one or more interfaces. The interfaces can include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc. The processor 110 can connect the audio module, the communication module, the display screen, and other modules through at least one of the above interfaces.
[0183] It can be understood that the interface connection relationship between the modules shown in the embodiments of the present application is only illustrative and does not constitute a structural limitation of the electronic device 60. In some other embodiments of the present application, the electronic device 60 can also use different interface connection modes or a combination of multiple interface connection modes in the above embodiments.
[0184] The communication module 130 of the electronic device 60 can include a wireless communication module and / or a wired communication module. The communication function of the electronic device 60 can be realized through an antenna, a wireless communication module, a wired communication module, a modem processor, and a baseband processor, etc.
[0185] The antenna can be used to transmit and receive electromagnetic wave signals. The antenna in the electronic device 60 can be used to cover a single or multiple communication frequency bands. When the electronic device 60 includes multiple antennas, different antennas can also be multiplexed to improve the utilization rate of the antennas. For example, a certain antenna in multiple antennas can be multiplexed as a diversity antenna of a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0186] The wireless communication module can provide a solution including 2G / 3G / 4G / 5G wireless communication applied on the electronic device 60. For example, the wireless communication module can include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The wireless communication module can receive electromagnetic waves by the antenna, and perform filtering, amplification, etc. on the received electromagnetic waves, and transmit to the modem processor for demodulation. The wireless communication module can also amplify the signal modulated by the modem processor, and convert to electromagnetic waves by the antenna to radiate out. In some embodiments, at least part of the functional modules of the wireless communication module can be arranged in the processor 110. In some embodiments, at least part of the functional modules of the wireless communication module can be arranged in the same device as at least part of the modules of the processor 110.
[0187] The modem processor can include a modulator and a demodulator. The modulator is configured to modulate a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is configured to demodulate a received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. The low-frequency baseband signal processed by the baseband processor is transmitted to the application processor. The application processor outputs a sound signal through an audio device, or displays an image or video through the display screen 160. In some embodiments, the modem processor can be a separate device. In other embodiments, the modem processor can be independent of the processor 110, and arranged in the same device as the communication module 130 or other functional modules.
[0188] The wireless communication module can also be used to provide wireless communication solutions applied on the electronic device 60, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), Bluetooth low energy (BLE), ultra wide band (UWB), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc. The wireless communication module can be one or more devices integrated with at least one communication processing module. For example, the wireless communication module can receive electromagnetic waves via an antenna, frequency modulate and filter the electromagnetic wave signals, and send the processed signals to the processor 110. The wireless communication module can also receive signals to be sent from the processor 110, frequency modulate them, amplify them, and convert them into electromagnetic wave radiation via an antenna.
[0189] In some embodiments, the antenna of the electronic device 60 can be coupled with the wireless communication module, so that the electronic device 60 can communicate with a network and other electronic devices through wireless communication technology. The wireless communication technology can include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS can include global positioning system (GPS), global navigation satellite system (GLONASS), beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS), and / or satellite based augmentation systems (SBAS).
[0190] The electronic device 60 can implement a display function through a GPU, a display screen 160, and an application processor, etc. The GPU is a microprocessor for image processing, which is connected to the display screen 160 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs, which execute program instructions to generate or change display information.
[0191] The sensor module can include a touch sensor, a pressure sensor, a fingerprint sensor, and the like. The display 160 is configured to display images, videos, and the like. The display 160 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flex light-emitting diode (FLED), a Miniled, a Micro Led, a Micro-oLed, a quantum dot light emitting diodes (QLED), and the like. In some embodiments, the electronic device 60 can include one or more displays 160.
[0192] The display 160 digital signal processor is configured to process digital signals, and can also process other digital signals. For example, when the electronic device 60 selects a frequency point, the digital signal processor is configured to perform Fourier transform on the frequency point energy, and the like.
[0193] The video codec is configured to compress or decompress digital video. The electronic device 60 can support one or more video codecs. In this way, the electronic device 60 can play or record videos in multiple encoding formats, such as moving picture experts group (MPEG) 1, MPEG 2, MPEG 3, MPEG 4, and the like.
[0194] The NPU is a neural-network (NN) computing processor. By drawing on the structure of a biological neural network, such as drawing on the transmission mode between human brain neurons, the NPU can quickly process input information and can also constantly self-learn. Through the NPU, the electronic device 60 can implement intelligent cognition applications, such as image recognition, face recognition, voice recognition, text understanding, and the like.
[0195] The external memory interface 120 can be configured to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 60. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, music, video, and the like are saved in the external memory card. Or music, video, and the like are transmitted from the electronic device to the external memory card.
[0196] The internal memory 121 can be used to store computer executable program codes including instructions. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system, application programs required by at least one function (such as a sound playing function, an image playing function, etc.), and the like. The data storage area can store data (such as audio data, a phone book, etc.) created during use of the electronic device 60, and the like. In addition, the internal memory 121 can include a high-speed random access memory, and can further include a non-volatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like. The processor 110 executes various function methods or data processing of the electronic device 60 by running instructions stored in the internal memory 121 and / or instructions stored in a memory disposed in the processor.
[0197] The internal memory 121 is configured to store one or more computer programs. The one or more computer programs are configured to be executed by the processor 110. The one or more computer programs include instructions that can be used to implement the method of generating a network layer address as described in the embodiments of the present application in the electronic device 60. Figure 2 、 Figure 4 or Figure 5 The method of generating a network layer address.
[0198] The audio module 140 is configured to convert digital audio information into an analog audio signal output, and is also configured to convert an analog audio input into a digital audio signal. The audio module 140 can also be configured to encode and decode audio signals. In some embodiments, the audio module 140 can be disposed in the processor 110, or some functional modules of the audio module 140 can be disposed in the processor 110.
[0199] The embodiments of the present application also provide a computer storage medium having computer instructions stored therein, and when the computer instructions are run on an electronic device, the electronic device performs the above-mentioned related method steps to implement the method of generating a network layer address in the above-mentioned embodiments.
[0200] The embodiments of the present application also provide a computer program product, and when the computer program product is run on a computer, the computer performs the above-mentioned related steps to implement the method of generating a network layer address in the above-mentioned embodiments.
[0201] In addition, the embodiments of the present application also provide an apparatus, which can be a chip, a component, or a module, and the apparatus can include a processor and a memory connected to each other. The memory is configured to store computer executable instructions, and when the apparatus is running, the processor can execute the computer executable instructions stored in the memory to enable the chip to perform the method of generating a network layer address in the above-mentioned method embodiments.
[0202] Among them, the electronic device, computer storage medium, computer program product or chip provided by the embodiment are used for executing the corresponding method provided above, so the beneficial effects achieved by them can refer to the beneficial effects of the corresponding method provided above, which will not be repeated here.
[0203] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above division of functional modules is taken as an example, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
[0204] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented by other ways. For example, the apparatus embodiment described above is illustrative, for example, the division of the module or unit is a logical function division, and actual implementation can have another division way, for example, a plurality of units or components can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or components shown or discussed can be through some interfaces, indirect coupling or communication connection between the units or components, which can be electrical, mechanical or other forms.
[0205] The unit described as a separate component can or can not be physically separated, and the component shown as a unit can be one physical unit or multiple physical units, that is, it can be located in one place or distributed to multiple different places. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0206] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software functional unit.
[0207] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application essentially or say the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The software product is stored in a storage medium, including a number of instructions to make a device (which can be a single-chip microcomputer, a chip, etc.) or a processor execute all or part of the steps of the method described in various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0208] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any change or replacement within the technical scope disclosed in the present application should be covered within the protection scope of the present application.
Claims
1. A communication system, characterized by The communication system comprises at least two nodes belonging to the same layer 2 network and capable of communicating with each other; the layer 2 network has public information, which is information obtainable by the at least two nodes; The nodes are configured to: obtain the public information of the communication system; derive a public key based on the public information and a preset key derivation algorithm; obtain a MAC address of the node and form a first random number; form first plaintext data based on the MAC address of the node and the first random number; encrypt the first plaintext data based on the public key and a preset symmetric encryption algorithm to obtain first encrypted data; form a first network layer address based on the first encrypted data.
2. The communication system of claim 1, wherein, The communication system further comprises a subnet center configured to: send a first broadcast message to the at least two nodes, the first broadcast message carrying the public information; The nodes are configured to: receive the first broadcast message sent by the subnet center and parse the first broadcast message to obtain the public information.
3. The communication system of claim 2 wherein, The subnet center is further configured to: form a second random number; send a second broadcast message to the at least two nodes, the second broadcast message carrying the second random number; The nodes are further configured to: receive the second broadcast message sent by the subnet center and set the second random number as a salt value of the key derivation algorithm; derive a public key based on the public information, the salt value and the key derivation algorithm.
4. The communication system of claim 1, wherein, The nodes are further configured to: obtain routing table information, the routing table information comprising a globally unique identifier of the at least two nodes and a target network layer address corresponding to the globally unique identifier; If the routing table has a target network layer address identical to the first network layer address, the nodes are further configured to: form a third random number; form second plaintext data based on the MAC address and the third random number; encrypt the second plaintext data based on the public key and a preset symmetric encryption algorithm to obtain second encrypted data; form a second network layer address based on the second encrypted data.
5. The communication system of claim 1, wherein, The nodes are further configured to: obtain a network layer address generated by a target node among the at least two nodes; decrypt the network layer address of the target node based on the public key and the symmetric encryption algorithm to obtain the MAC address of the target node.
6. The communication system of claim 5 wherein, The nodes are further configured to: form a correspondence between the MAC address of the target node and the network layer address.
7. The communication system of claim 1, wherein, The nodes are further configured to: determine a target node among the at least two nodes as a master node; obtain the MAC address of the target node and set the MAC address of the target node as the public information.
8. The communication system of claim 7 wherein, If the target node is a communication initiator, the nodes are further configured to: determine the target node as the master node based on the target node being the communication initiator.
9. The communication system of claim 2, wherein, The public information is a MAC address of the subnet center.
10. The communication system of claim 2, wherein, The subnet center is a WiFi wireless access point, and the at least two nodes are all stations.
11. The communication system of claim 1 wherein, If the first network layer address is an IPv6 local link address, the nodes are further configured to: determining a high 64-bit of the IPv6 local link address according to the first encrypted data; determining a low 64-bit of the IPv6 local link address according to the first encrypted data; forming the IPv6 local link address according to the high 64-bit and the low 64-bit.
12. A method of generating a network layer address, characterized by, The method is applied to a node, the node belongs to a Layer 2 network, and the Layer 2 network has public information; the method comprises the following steps: obtaining the public information; forming a public key according to the public information and a preset key derivation algorithm; obtaining a MAC address of the node and forming a first random number; forming first plaintext data according to the MAC address of the node and the first random number; encrypting the first plaintext data according to the public key and a preset symmetric encryption algorithm to obtain first encrypted data; forming a first network layer address according to the first encrypted data.
13. The method of claim 12, wherein, The Layer 2 network has a subnet center, and the step of obtaining the public information comprises the following steps: receiving a first broadcast message sent by the subnet center, and parsing the first broadcast message to obtain the public information, wherein the first broadcast message carries the public information.
14. The method of claim 13, wherein, The step of forming the public key according to the public information and the preset key derivation algorithm comprises the following steps: receiving a second broadcast message sent by the subnet center, wherein the second broadcast message carries a second random number formed by the subnet center; setting the second random number as a salt value of the key derivation algorithm; forming the public key according to the public information, the salt value and the key derivation algorithm.
15. The method of claim 12, wherein, The method further comprises the following steps: obtaining routing table information, wherein the routing table information comprises global unique identifiers of all nodes in the Layer 2 network and target network layer addresses corresponding to the global unique identifiers; if there is a target network layer address same as the first network layer address in the routing table, forming a third random number; forming second plaintext data according to the MAC address of the node and the third random number; encrypting the second plaintext data according to the public key and the symmetric encryption algorithm to obtain second encrypted data; forming a second network layer address according to the second encrypted data.
16. The method of claim 12, wherein, The Layer 2 network further comprises at least one node, and the method further comprises the following steps: obtaining a third network layer address of a target node in the Layer 2 network; decrypting the third network layer address according to the public key and the symmetric encryption algorithm to obtain a MAC address of the target node.
17. The method of claim 16, wherein, The method further comprises the following steps: forming a correspondence between the MAC address and the third network layer address.
18. The method of claim 12, wherein, The step of obtaining the public information comprises the following steps: determining that a target node of the Layer 2 network is a master node; obtaining a MAC address of the target node and setting the MAC address of the target node as the public information.
19. The method of claim 18, wherein, If the target node is a communication initiator, the step of determining that the target node is the master node comprises the following step: determining that the target node is the master node according to that the target node is the communication initiator.
20. The method of claim 12, wherein, If the first network layer address is an IPv6 local link address, the step of forming the first network layer address according to the first encrypted data comprises the following steps: determining a high 64-bit of the IPv6 local link address; determining a low 64-bit of the IPv6 local link address according to the first encrypted data; forming the IPv6 local link address according to the high 64-bit and the low 64-bit.
21. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions which, when executed on an electronic device, cause the electronic device to perform the method of any one of claims 12-20.
22. An electronic device, comprising: The electronic device comprises a processor and a memory, the memory being configured to store instructions, and the processor being configured to invoke the instructions in the memory to cause the electronic device to perform the method of any one of claims 12-20.
23. A chip coupled with a memory in an electronic device, the chip comprising: The chip is configured to control the electronic device to perform the method of any one of claims 12-20.
Citation Information
Patent Citations
Wireless sensor network security routing method based on IPv6 addressing
CN104811934A
Method of automatically distributing network addresses for cascaded devices based on link layer data communication
CN106790741A