Key generation method and device

CN120826892APending Publication Date: 2025-10-21GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202380095404.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-10
Publication Date
2025-10-21

AI Technical Summary

Technical Problem

The communication channel between the zero-power device and the target device is insecure, leading to security and efficiency issues in data transmission. In particular, how to ensure the security and efficiency of the key during the key generation process is a challenge.

Method used

The first device sends multiple messages to the second device. The second device generates a key and determines that the key verification passes after receiving the confirmation message. The first device generates a verification key based on the multiple second messages and the target model. key to ensure the randomness and consistency of the key.

Benefits of technology

The security and efficiency of key generation are improved, the consistency of the key between the first device and the second device is ensured, and the key generation problem caused by channel insecurity is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120826892A_ABST
    Figure CN120826892A_ABST
Patent Text Reader

Abstract

The invention relates to a key generation method and device, a computer readable storage medium, a computer program product and a computer program. The method comprises: a first device sends a plurality of first messages to a second device, different first messages in the plurality of first messages occupying different time domain ranges, and the plurality of first messages are used for the second device to generate a key; the first device receives a plurality of second messages sent by the second device, different second messages in the plurality of second messages are related to different first messages, and the last second message in the plurality of second messages carries a key of the second device; the first device generates a verification key of the second device based on the plurality of second messages and a target model; and under the condition that the verification key of the second equipment is consistent with the key of the second equipment, the first equipment sends a confirmation message to the second equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Key generation method and device Technical Field The present application relates to the field of communications, and more specifically, to a key generation method, device, computer-readable storage medium, computer program product, and computer program. Background Art With the development of communication technology, contactless automatic identification technology has emerged. This technology usually uses wireless radio frequency to perform contactless data transmission between zero-power devices and target devices. Since the communication channel between the zero-power device and the target device is an unsecured channel, in order to ensure the security of data transmission between the zero-power device and the target device, a scheme is further proposed in which a key can be used between the zero-power device and the target device to encrypt the data or information transmitted between the two. In this scheme, usually a zero-power device and the target device both use the same pair key (or unicast key). However, how to ensure the security and efficiency of generating the pair key becomes a problem that needs to be solved. Summary of the invention Embodiments of the present application provide a key generation method, device, computer-readable storage medium, computer program product, and computer program. The present invention provides a method for generating a key, including: The first device sends a plurality of first messages to the second device, wherein different first messages in the plurality of first messages occupy different time domain ranges, and the plurality of first messages are used for the second device to generate a key; The first device receives a plurality of second messages sent by the second device, where different second messages in the plurality of second messages are related to different first messages, and the last second message in the plurality of second messages carries a key of the second device; The first device generates a verification key for the second device based on the plurality of second messages and a target model; When the verification key of the second device is consistent with the key of the second device, the first device sends a confirmation message to the second device. In one embodiment of the present application, the first device generates a verification key of the second device based on the multiple second messages and the target model, including: The first device obtains a plurality of parameter estimation values ​​based on the plurality of second messages and the target model, wherein different parameter estimation values ​​among the plurality of parameter estimation values ​​are estimation values ​​of relevant parameters of different first messages obtained by the second device; The first device determines a verification key for the second device based on the plurality of parameter estimates. In one embodiment of the present application, the first device obtains multiple parameter estimation values ​​based on the multiple second messages and the target model, including: The first device preprocesses relevant parameters of each second message in the multiple second messages to obtain the preprocessed relevant parameters of each second message; The first device inputs the preprocessed relevant parameters of each second message into the target model to obtain the multiple parameter estimation values ​​output by the target model. In one embodiment of the present application, the first device preprocesses the relevant parameters of each second message in the multiple second messages to obtain the preprocessed relevant parameters of each second message, including: The first device determines a first standard deviation and a first average value based on relevant parameters of each second message in the plurality of second messages; The first device preprocesses the relevant parameters of each second message based on the first average value and the first standard deviation to obtain the preprocessed relevant parameters of each second message. In some possible embodiments, the first device obtains a plurality of parameter estimation values ​​based on the plurality of second messages and the target model, including: The first device inputs relevant parameters of each second message in the multiple second messages into the target model to obtain the multiple parameter estimation values ​​output by the target model. The target model is used to preprocess the relevant parameters of each second message to obtain the preprocessed relevant parameters of each second message, and obtain the multiple parameter estimation values ​​based on the preprocessed relevant parameters of each second message. In one embodiment of the present application, the last second message carries multiple quantization offsets, and different quantization offsets in the multiple quantization offsets are related to relevant parameters of different first messages obtained by the second device; The first device determines the verification key of the second device based on the multiple parameter estimation values, including: the first device obtains multiple quantization reference estimation values ​​based on the multiple parameter estimation values ​​and the multiple quantization offsets; the first device determines multiple quantization estimation results based on the index value of each quantization reference estimation value in the multiple quantization reference estimation values; the first device obtains the verification key of the second device based on the multiple quantization estimation results. In one embodiment of the present application, the relevant parameters include reception strength. In one embodiment of the present application, the relevant parameter includes phase. The present invention provides a method for generating a key, including: The second device receives multiple first messages sent by the first device, where different first messages in the multiple first messages occupy different time domain ranges; The second device generates a key of the second device based on the plurality of first messages; The second device sends multiple second messages to the first device, different second messages in the multiple second messages are related to different first messages, and the last second message in the multiple second messages carries a key of the second device; When the second device receives the confirmation message sent by the first device, it determines that the key verification of the second device has passed. In one embodiment of the present application, the second device generates a key of the second device based on the multiple first messages, including: The second device obtains a second average value and a second standard deviation based on relevant parameters of each first message in the plurality of first messages; The second device obtains a plurality of processed related parameters based on the second average value, the second standard deviation, and the related parameters of each first message; The second device obtains a plurality of quantization reference values ​​based on the plurality of processed related parameters; The second device generates a key of the second device based on the plurality of quantization reference values. In one embodiment of the present application, the second device generates a key of the second device based on the multiple quantization reference values, including: The second device determines a plurality of quantization results based on an index value of each quantization reference value in the plurality of quantization reference values; The second device generates a key of the second device based on the multiple quantization results. In one embodiment of the present application, the last second message carries multiple quantization offsets; and the method further includes: The second device obtains the multiple quantization offsets based on the multiple quantization reference values ​​and the multiple processed related parameters. In one embodiment of the present application, the related parameter is reception strength. In one embodiment of the present application, the related parameter is phase. The present application embodiment provides a first device, including: A first communication unit is configured to send a plurality of first messages to a second device, wherein different first messages in the plurality of first messages occupy different time domain ranges, and the plurality of first messages are used by the second device to generate a key; and receive a plurality of second messages sent by the second device, wherein different second messages in the plurality of second messages are related to different first messages, and a last second message in the plurality of second messages carries the key of the second device; The first processing unit is used to generate a verification key for the second device based on the multiple second messages and the target model, and send a confirmation message to the second device through the first communication unit when the verification key of the second device is consistent with the key of the second device. In one embodiment of the present application, the first processing unit is used to obtain a plurality of parameter estimation values ​​based on the plurality of second messages and the target model, wherein different parameter estimation values ​​among the plurality of parameter estimation values ​​are estimation values ​​of relevant parameters of different first messages obtained by the second device; and determine the verification key of the second device based on the plurality of parameter estimation values. In one embodiment of the present application, the first processing unit is used to preprocess relevant parameters of each second message in the multiple second messages to obtain the preprocessed relevant parameters of each second message; and input the preprocessed relevant parameters of each second message into the target model to obtain the multiple parameter estimation values ​​output by the target model. In one embodiment of the present application, the first processing unit is used to determine a first standard deviation and a first average value based on relevant parameters of each second message in the multiple second messages; preprocess the relevant parameters of each second message based on the first average value and the first standard deviation to obtain the preprocessed relevant parameters of each second message. In one embodiment of the present application, the first processing unit is used to input relevant parameters of each second message among the multiple second messages into the target model to obtain the multiple parameter estimation values ​​output by the target model, and the target model is used to preprocess the relevant parameters of each second message to obtain the preprocessed relevant parameters of each second message, and obtain the multiple parameter estimation values ​​based on the preprocessed relevant parameters of each second message. In one embodiment of the present application, the last second message carries multiple quantization offsets, and different quantization offsets among the multiple quantization offsets are related to relevant parameters of different first messages obtained by the second device; the first processing unit is used to obtain multiple quantization reference estimation values ​​based on the multiple parameter estimation values ​​and the multiple quantization offsets; determine multiple quantization estimation results based on the index value of each quantization reference estimation value among the multiple quantization reference estimation values; and obtain the verification key of the second device based on the multiple quantization estimation results. In one embodiment of the present application, the relevant parameters include reception strength. In one embodiment of the present application, the relevant parameter includes phase. The embodiment of the present application provides a second device, including: The second communication unit is configured to receive a plurality of first messages sent by a first device, wherein different first messages in the plurality of first messages occupy different time domain ranges; and send a plurality of second messages to the first device, wherein different second messages in the plurality of second messages occupy different time domain ranges. A message is associated with the second device, and a last second message of the plurality of second messages carries a key of the second device; The second processing unit is used to generate a key for the second device based on the multiple first messages; when a confirmation message sent by the first device is received through the second communication unit, determine that the key verification of the second device has passed. In one embodiment of the present application, the second processing unit is used to obtain a second average value and a second standard deviation based on relevant parameters of each first message in the multiple first messages; obtain a plurality of processed relevant parameters based on the second average value, the second standard deviation and relevant parameters of each first message; obtain a plurality of quantized reference values ​​based on the plurality of processed relevant parameters; and generate a key of the second device based on the plurality of quantized reference values. In one embodiment of the present application, the second processing unit is used to determine multiple quantization results based on the index value of each quantization reference value in the multiple quantization reference values; and generate a key for the second device based on the multiple quantization results. In one embodiment of the present application, the last second message carries multiple quantization offsets; and the second processing unit is used to obtain the multiple quantization offsets based on the multiple quantization reference values ​​and the multiple processed related parameters. In one embodiment of the present application, the related parameter is reception strength. In one embodiment of the present application, the related parameter is phase. The embodiment of the present application provides a first device, including a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory, so that the first device executes the above method. The embodiment of the present application provides a second device, including a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory, so that the second device executes the above method. The embodiment of the present application provides a chip for implementing the above method. Specifically, the chip includes: a processor, which is used to call and run a computer program from a memory, so that a device equipped with the chip executes the above method. An embodiment of the present application provides a computer-readable storage medium for storing a computer program, which enables a device to perform the above method when the computer program is executed by the device. An embodiment of the present application provides a computer program product, including computer program instructions, which enable a computer to execute the above method. An embodiment of the present application provides a computer program, which, when executed on a computer, enables the computer to execute the above method. By adopting the scheme provided by this embodiment, the first device sends multiple first messages, which are used to generate a key for the second device, and the first device receives multiple second messages sent by the second device, and the last second message in the multiple second messages carries the key of the second device; the first device generates a verification key based on the multiple second messages and the target model, and sends a confirmation message when it is determined that the verification key is consistent with the key. In this way, since the key of the second device is generated based on multiple first messages, and the verification key obtained by the first device is generated based on multiple second messages, the randomness of the key generation can be guaranteed, thereby ensuring the security of the key; in addition, since the verification key is generated by the first device based on multiple second messages and the target model, the efficiency of the first device in generating the verification key can be guaranteed; due to the short-term mutual difference of the channel between the first device and the second device, the consistency of the verification key obtained by the first device and the key obtained by the second device can also be guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a schematic diagram of an application scenario according to an embodiment of the present application. FIG2 is a schematic diagram of a zero-power communication system based on backscattering. FIG3 is a schematic flowchart of a key generation method according to an embodiment of the present application. FIG4 is a schematic flowchart of a key generation method according to another embodiment of the present application. FIG5 is a schematic diagram of the correspondence between candidate quantization reference values ​​and their corresponding index values ​​and quantization values ​​according to an embodiment of the present application. FIG6 is an exemplary flowchart of a processing flow of a key generation method according to an embodiment of the present application. FIG. 7 is another exemplary flowchart of the processing flow of the key generation method according to an embodiment of the present application. FIG8 is a schematic diagram of a processing scenario of a key generation method according to an embodiment of the present application. FIG. 9 is a schematic diagram of another processing flow of a key generation method according to an embodiment of the present application. FIG. 10 is a schematic diagram of LSTM processing according to an embodiment of the present application. 11 to 12 are example diagrams of various simulation experiment results based on the key generation method provided in the embodiments of the present application. FIG. 13 is a schematic block diagram of a first device according to an embodiment of the present application. FIG. 14 is a schematic block diagram of a second device according to an embodiment of the present application. FIG. 15 is a schematic block diagram of a communication device according to an embodiment of the present application. FIG. 16 is a schematic block diagram of a chip according to an embodiment of the present application. FIG. 17 is a schematic block diagram of a communication system according to an embodiment of the present application. DETAILED DESCRIPTION The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. The technical solutions of the embodiments of the present application can be applied to various communication systems, such as GSM, CDMA, WCDMA, GPRS, LTE, LTE-A, NR, NR evolution, WLAN, WiFi, or other communication systems. The embodiments of the present application describe various embodiments in combination with network devices and terminals. The terminal may be mobile or fixed, and the terminal may also be referred to as a mobile station, a user unit, etc. The terminal may be a site in a WLAN, and may be a smart terminal, a wireless modem, a laptop computer, a tablet computer, or other terminals. In the embodiments of the present application, the terminal may be a VR terminal / AR terminal, an industrial control terminal, an unmanned driving terminal, a telemedicine terminal, a smart grid terminal, a transportation safety terminal, a smart city terminal, or a wireless terminal for a smart home, etc. As an example and not a limitation, in the embodiments of the present application, the terminal may also be a wearable device. In the embodiment of the present application, the network device may be a device for communicating with a terminal, and the network device may be an access point in WLAN, a base station in GSM, CDMA or WCDMA, or an evolved base station in LTE, or a relay station, or a vehicle-mounted device, a wearable device, and a network device (gNB) in an NR network, or a network device in a future evolved PLMN network, or a network device in a non-terrestrial network, etc. As an example and not a limitation, in the embodiment of the present application, the network device may have a mobile feature, for example, the network device may be a mobile device. It should be understood that the terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the objects associated with each other are in an "or" relationship. It should be understood that the "indication" mentioned in the embodiments of the present application can be a direct indication, an indirect indication, or an indication of an association relationship. For example, A indicates B, which can mean that A directly indicates B, for example, B can be obtained through A; it can also mean that A indirectly indicates B, for example, A indicates C, and B can be obtained through C; it can also mean that there is an association relationship between A and B. In the description of the embodiments of the present application, the term "correspondence" can mean that there is a direct or indirect correspondence relationship between the two, or it can mean that there is an association relationship between the two, or it can mean that there is an indication and being indicated, configuration and being configured, etc. To facilitate understanding of the technical solutions of the embodiments of the present application, the relevant technologies of the embodiments of the present application are described below. The following related technologies can be arbitrarily combined with the technical solutions of the embodiments of the present application as optional solutions, and they all belong to the protection scope of the embodiments of the present application. FIG1 exemplarily shows a communication system 100. The communication system includes a network device 110 and two terminals 120. In a possible implementation, the communication system 100 may include multiple network devices 110, and each network device 110 may include other number of terminals 120 within its coverage area, which is not limited in the embodiment of the present application. In a possible implementation, the communication system 100 may also include a mobility management entity, an access and mobility management function, and other network entities, which is not limited in the embodiment of the present application. Among them, the network device may include an access network device and a core network device. That is, the communication system may also include multiple core networks for communicating with the access network device. The access network device may be a base station of an LTE, LTE-A, or NR system. Taking the communication system shown in FIG1 as an example, the communication device may include a network device and a terminal with a communication function, and the communication device may also include other devices in the communication system, such as a network controller, a mobile management entity, and other network entities, which are not limited in the embodiment of the present application. In order to facilitate understanding of the embodiments of the present application, the basic processes and basic concepts involved in the embodiments of the present application are briefly described below. It should be understood that the basic processes and basic concepts introduced below do not limit the embodiments of the present application. Zero-power communication is a wireless communication technology suitable for short distances and low rates. The basic architecture of the zero-power communication system is shown in Figure 2, which includes a reader and a tag; the tag can have functions such as energy harvesting, backscatter communication, and low-power computing. Tag is a type of zero-power device. In actual scenarios, zero-power devices can also be ordinary devices, which are not limited here. The outstanding technical advantage of zero-power communication is battery-free communication. In a zero-power communication system based on backscattering, zero-power devices transmit data by modulating and reflecting the received RF (Radio Frequency) signals through a backscattering transmitter. Based on the energy source and usage of zero-power devices, zero-power devices can be divided into: passive zero-power devices, which do not require built-in batteries, but use antennas to generate induced currents through electromagnetic induction, and the induced currents drive the low-power chip circuits of zero-power devices; semi-passive zero-power devices, which do not install conventional batteries themselves, but can use RF energy collection modules to collect radio wave energy, and store the collected energy in an energy storage unit. After the energy storage unit obtains energy, it can drive the low-power chip circuits of semi-passive zero-power devices; active zero-power devices, which can have built-in batteries to drive the low-power chip circuits of active zero-power devices to achieve demodulation of forward link signals and modulation of backward link signals. Fig. 3 is a schematic flow chart of a key generation method according to an embodiment of the present application. The method includes at least part of the following contents. S310. The first device sends multiple first messages to the second device, where different first messages in the multiple first messages occupy different time domain ranges, and the multiple first messages are used by the second device to generate a key; S320: The first device receives multiple second messages sent by the second device, where different second messages in the multiple second messages are related to different first messages, and the last second message in the multiple second messages carries a key of the second device; S330: The first device generates a verification key for the second device based on the multiple second messages and the target model; S340: When the verification key of the second device is consistent with the key of the second device, the first device sends a confirmation message to the second device. Here, the first device may be a first terminal or a first network device. The second device may be a zero-power consumption device. Fig. 4 is a schematic flow chart of a key generation method according to another embodiment of the present application. The method includes at least part of the following contents. S410. The second device receives multiple first messages sent by the first device, where different first messages in the multiple first messages occupy different time domain ranges; S420: The second device generates a key of the second device based on the multiple first messages; S430: The second device sends multiple second messages to the first device, where different second messages in the multiple second messages are related to different first messages, and the last second message in the multiple second messages carries the key of the second device; S440: When the second device receives the confirmation message sent by the first device, it determines that the key verification of the second device passes. The number of the aforementioned multiple first messages is the same as the number of the aforementioned multiple second messages. The multiple first messages may be multiple first messages for generating a key. Different second messages in the multiple second messages are related to different first messages, which may mean that different second messages in the multiple second messages are messages reflected from different first messages. In some possible implementations, the second device generating the key of the second device based on the multiple first messages may include: the second device generating the key of the second device based on relevant parameters of each first message in the multiple first messages. Specifically, the second device generates a key of the second device based on the multiple first messages, including: the second device obtains a second average value and a second standard deviation based on relevant parameters of each first message in the multiple first messages; the second device obtains a plurality of processed relevant parameters based on the second average value, the second standard deviation and relevant parameters of each first message; the second device obtains a plurality of quantized reference values ​​based on the plurality of processed relevant parameters; and the second device generates the key of the second device based on the plurality of quantized reference values. The second device obtains multiple quantization reference values ​​based on the multiple processed related parameters, including: the second device determines, based on multiple candidate quantization reference values, that the candidate quantization reference value with the smallest difference with the mth processed related parameter is the mth quantization reference value, the multiple candidate quantization reference values ​​are determined based on the related parameters of each first message, the mth processed related parameter is one of the multiple processed related parameters, the mth quantization reference value is one of the multiple quantization reference values, and m is a positive integer. The second device generates a key of the second device based on the multiple quantization reference values, including: the second device determines multiple quantization results based on the index value of each quantization reference value in the multiple quantization reference values; the second device generates the key of the second device based on the multiple quantization results. The relevant parameter is the receiving strength; or the relevant parameter is the phase. The specific process of the second device generating the key is described below in different cases of relevant parameters. In some embodiments, the aforementioned related parameter is the receiving strength. The aforementioned related parameter of the first message is the receiving strength of the first message; the aforementioned related parameter after processing is the receiving strength after processing. In some possible examples, the aforementioned receiving strength may also be referred to as received signal strength. Taking any one of the multiple first messages as the mth first message as an example, the way in which the second device obtains the receiving strength of the mth first message may include: the second device performs multiple measurements within the duration of the mth first message to obtain multiple strength measurement values ​​of the mth first message, and averages the multiple strength measurement values ​​of the mth first message to obtain the receiving strength of the mth first message, where m is an integer greater than or equal to 1. Since the way in which the second device obtains the receiving strength of each first message is the same as the way in which the receiving strength of the mth first message is obtained, they are not described one by one. Here, the second device performs multiple measurements within the duration of the mth first message according to a preset measurement period, and the period length of the measurement period is less than the duration of any one message; for example, if the duration of any one message is 1 millisecond, the measurement period may be 0.1 millisecond, 0.05 millisecond, or longer or shorter, which are not exhaustively listed here. The second device obtains a second average value and a second standard deviation based on the relevant parameters of each of the multiple first messages, which may specifically include: the second device obtains a second average value and a second standard deviation based on the receiving strength of each of the multiple first messages. In this embodiment, the second average value is specifically the receiving strength average value of the first message, and the second standard deviation is specifically the receiving strength standard deviation of the first message. The second device obtains a plurality of processed related parameters based on the second average value, the second standard deviation and the related parameters of each first message. Specifically, the second device obtains the mth processed receiving intensity by dividing the difference between the receiving intensity of the mth first message and the average receiving intensity of the first message by the standard deviation of the receiving intensity of the first message. The processing method for each first message is the same as that for the mth first message, and will not be elaborated one by one. For example, assuming that the number of first messages used to generate the key is M, M is an integer greater than or equal to 2, and the receiving intensity is represented by RSSI (Received Signal Strength Indicator); the RSSIs of the M first messages can form a set, and the set is represented as T represents the second device, Indicates the Mth number of A set of RSSIs of each first message in a message. Further, assuming that the average receiving strength of the first message is expressed as The standard deviation of the received strength of the first message is expressed as Then the second device obtains the mth processed receiving strength, which can be calculated using the following formula: is a set consisting of M processed receiving strengths, and any processed receiving strength in the set may be the aforementioned m-th processed receiving strength. The second device determines, based on multiple candidate quantization reference values, the candidate quantization reference value with the smallest difference from the mth processed related parameter as the mth quantization reference value, which may include: the second device determines, based on multiple candidate quantization reference values, the candidate quantization reference value with the smallest difference from the mth processed receiving strength as the mth quantization reference value. The multiple candidate quantization reference values ​​are determined based on the receiving strength of each of the first messages, the mth processed receiving strength is one of the multiple processed related parameters, and the mth quantization reference value is one of the multiple quantization reference values. Since the determination method of each quantization reference value in the multiple quantization reference values ​​is the same as the determination method of the mth quantization reference value, they are not described one by one. In this embodiment, the quantization reference value may be a strength quantization reference value, the candidate quantization reference value may be a candidate strength quantization reference value, and the quantization reference set may be a strength quantization reference set. For example, the specific process of obtaining the mth strength quantization reference value may be expressed by the following formula: argmin means calculating the variable value that makes the objective function take the minimum value. The variable is q and the objective function is The objective function represents the absolute value of the difference between the variable q and the received intensity after the mth processing, Q K represents the intensity quantization reference set, K represents the number of candidate intensity quantization reference values ​​contained in the intensity quantization reference set, q∈Q K Denotes variable q as set Q K A candidate intensity quantization reference value in represents the received intensity after the mth processing, represents the mth intensity quantization reference value. The M quantization reference values ​​finally obtained can be expressed as the following set form The intensity quantization reference set Q K The K candidate quantization reference values ​​may be included, and the strength quantization reference set Q K For interval The K candidate strength quantization reference values ​​are arranged from small to large, and each candidate strength quantization reference value has a corresponding index value in the strength quantization reference set; among the aforementioned K candidate strength quantization reference values, the intervals between any adjacent candidate strength quantization reference values ​​are the same, that is, the K candidate strength quantization reference values ​​are equally spaced. The value of K can be related to the length b of the quantization result of a single first message, for example, K = 2 b , assuming b is equal to 4, then K is equal to 16. Exemplarily, the intensity quantization reference set can be expressed as: Q K ={q1,q1,…,q K}, the subscripts 1 to K of each q are the index values ​​of each candidate intensity quantization reference value in the intensity quantization reference set; q1 to q K represents K candidate intensity quantization reference values, the K candidate intensity quantization reference values ​​are arranged from small to large, and the intervals between any adjacent candidate intensity quantization reference values ​​are the same. The strength quantization reference set may be determined by the second device based on the receiving strength of each first message in the multiple first messages. Specifically, the process of the second device generating the strength quantization reference set may include: the second device determines the maximum receiving strength and the minimum receiving strength from the receiving strength of each first message in the multiple first messages; divides K intervals between the maximum receiving strength and the minimum receiving strength; selects an intermediate value in each of the K intervals as K candidate strength quantization reference values ​​in the strength quantization reference set, and the difference between the maximum value and the minimum value of different intervals in the K intervals is the same. Taking Figure 5 as an example, assuming that K is 16, the maximum receiving strength and the minimum receiving strength are expressed as In FIG5 , the horizontal axis represents the candidate strength quantization reference value, and the left point 501 in the horizontal axis represents the minimum receiving strength. The last point 504 on the horizontal axis represents the maximum receiving strength. Assuming that 501-502 represents the first interval, and 502-503 represents the second interval, it can be seen that the first interval and the second interval have the same size, that is, the difference between the maximum and minimum values ​​of the two intervals is the same, and other intervals are not described in detail; q1 is the middle value of the first interval, and q1 is the first candidate intensity quantization reference value, and so on, q2~q 16 They are the 2nd to 16th candidate intensity quantization reference values, and are also the middle values ​​of their respective intervals. As shown in FIG5 , the intervals between any adjacent candidate intensity quantization reference values ​​are the same; finally, 16 candidate intensity quantization reference values ​​in the intensity quantization reference set can be obtained, and the intensity quantization reference set can be expressed as Q K ={q1,q2,…,q16}. The second device generates a key of the second device based on the multiple quantization reference values, including: the second device determines multiple quantization results based on the index value of each quantization reference value in the multiple quantization reference values; the second device generates a key of the second device based on the multiple quantization results. Generate a key for the second device. Among the multiple quantization results, the length of each quantization result is b, where b is an integer greater than or equal to 2. Specifically, the second device obtains the index value of each quantization reference value in the multiple quantization reference values ​​in a manner that: the second device inputs the mth intensity quantization reference value in the multiple intensity quantization reference values ​​into a preset classification formula, and obtains the index value of the mth intensity quantization reference value output by the preset classification formula, and the index value may refer to the index value corresponding to the mth intensity quantization reference value in the intensity quantization reference set. For example, the aforementioned preset classification formula may be expressed as f1(*) represents the calculation function of the preset classification formula. represents the mth intensity quantization reference value, index1 represents the index value, and index1 is an integer greater than or equal to 1 and less than or equal to K. Since the method for determining the index value of each intensity quantization reference value is the same as the method for determining the index value of the mth intensity quantization reference value, they are not described one by one. The second device determines multiple quantization results based on the index value of each quantization reference value in the multiple quantization reference values. This can be: the second device determines the quantization value corresponding to the index value of each intensity quantization reference value in the multiple intensity quantization reference values ​​based on the quantization mapping relationship, and uses the quantization value corresponding to the index value of each intensity quantization reference value in the multiple intensity quantization reference values ​​as the multiple quantization results; or the second device inputs the index value of each intensity quantization reference value in the multiple intensity quantization reference values ​​into the encoder, obtains the quantization value corresponding to each intensity quantization reference value output by the encoder respectively, and uses the quantization value corresponding to the index value of each intensity quantization reference value in the multiple intensity quantization reference values ​​as the multiple quantization results. Among them, the quantization mapping relationship may include: K candidate index values, and the candidate quantization value corresponding to each of the K candidate index values, and the quantization mapping relationship may be preset according to actual conditions. Taking Figure 5 as an example, assuming that K is equal to 16, the vertical axis in Figure 5 represents 16 candidate index values, that is, the quantization mapping relationship specifically includes: the candidate quantization value corresponding to candidate index value 1 is 0000, the candidate quantization value corresponding to candidate index value 2 is 0001, the candidate quantization value corresponding to candidate index value 3 is 0011, and so on, and the 16 candidate index values ​​illustrated in Figure 5 and their corresponding candidate quantization values ​​are not described one by one. In addition, in Figure 5, the candidate quantization value corresponding to the candidate index value "1" is expressed as

[0000] 2,

[0000] 2 is used to represent the set of bit values ​​of binary system is 0000, and other candidate quantization values ​​in FIG5 are similar thereto and will not be described repeatedly. The encoder may be a Grame encoder, for example, it may be expressed as g{index1}, where index1 indicates that the input is an index value of any intensity quantization reference value, and g{*} indicates a calculation function of the Grame encoder; that is, in the method of using the encoder for processing, any quantization value may be obtained using the formula Still in conjunction with FIG. 5 for exemplary description, assuming that the m-th intensity quantization reference value is equal to q1 in FIG. 5 , based on the aforementioned preset classification formula, the index value of the m-th intensity quantization reference value can be obtained as 1; the quantization value obtained by inputting the index value "1" into g{w} is "0000" as shown in FIG. 5 , and this "0000" can be used as the m-th quantization result among the M quantization results. The second device generates a key of the second device based on the multiple quantization results, which may specifically include: the second device combines the multiple quantization results to obtain the key of the second device. Taking the number of the aforementioned multiple quantization results as M as an example, the length of each quantization result is b, then the key length of the second device is equal to M multiplied by b. Assuming b=4, M=32, the key length (Keylen) of the second device is equal to 128. In some other embodiments, the aforementioned related parameter is a phase; the aforementioned related parameter of the first message is the phase of the first message, and the processed related parameter is the processed phase. Taking any one of the multiple first messages as the mth first message as an example, the manner in which the second device obtains the phase of the mth first message may include: the second device measures and obtains the phase of the mth first message within the duration of the mth first message, where m is an integer greater than or equal to 1. Since the manner in which the second device obtains the phase of each first message is the same as the manner in which the phase of the mth first message is obtained, they are not described one by one. The second device obtains a second average value and a second standard deviation based on the relevant parameters of each of the multiple first messages, which may specifically include: the second device obtains a second average value and a second standard deviation based on the phase of each of the multiple first messages. In this embodiment, the second average value is specifically the phase average value of the first message, and the second standard deviation is specifically the phase standard deviation of the first message. The second device obtains multiple processed related parameters based on the second average value, the second standard deviation and the related parameters of each first message. Specifically, the second device divides the difference between the phase of the mth first message and the phase average value of the first message by the phase standard deviation of the first message to obtain the mth processed phase. The processing method for each first message is the same as that for the mth first message, and will not be described one by one. For example, assuming that the specific number of the multiple first messages is M, M The phases of the first message can form a set, which is expressed as T represents the second device, represents a set of phase components of each first message obtained by the second device. Further, assuming that the phase average value of the first message is expressed as The phase standard deviation of the first message is expressed as Then the second device obtains the processing of the mth processed phase, which can be calculated using the following formula: is a set consisting of M processed phases, and any processed phase in the set may be the aforementioned m-th processed phase. The second device determines, based on multiple candidate quantization reference values, the candidate quantization reference value with the smallest difference from the mth processed related parameter as the mth quantization reference value, which may include: the second device determines, based on multiple candidate quantization reference values, the candidate quantization reference value with the smallest difference from the mth processed phase as the mth quantization reference value. The multiple candidate quantization reference values ​​are determined based on the phase of each of the first messages, the mth processed phase is one of the multiple processed related parameters, and the mth quantization reference value is one of the multiple quantization reference values. The method for determining each quantization reference value in the multiple quantization reference values ​​is the same as the method for determining the mth quantization reference value, and will not be described one by one. In this embodiment, the quantization reference value may be a phase quantization reference value, the candidate quantization reference value may be a phase quantization reference value, and the quantization reference set may be a phase quantization reference set. For example, the specific process of obtaining the mth phase quantization reference value may be expressed by the following formula: argmin means calculating the variable value that makes the objective function take the minimum value. The variable is q and the objective function is The objective function represents the absolute value of the difference between the variable q and the mth processed phase, Q K represents the phase quantization reference set of the second device, K represents the number of candidate phase quantization reference values ​​contained in the phase quantization reference set, q∈Q K Denotes variable q as set Q K A candidate phase quantization reference value in represents the mth processed phase, The multiple phase quantization reference values ​​finally obtained, assuming that the number of the multiple phase quantization reference values ​​is M, then the M phase quantization reference values ​​can be expressed as The phase quantization reference set may be determined by the second device based on the phase of each first message, and the process of the second device generating the quantization reference set may include: the second device determines the maximum phase and the minimum phase from the phase of each first message in the multiple first messages; divides K intervals between the maximum phase and the minimum phase; selects an intermediate value in each of the K intervals as K candidate phase quantization reference values ​​in the phase quantization reference set, and the difference between the maximum value and the minimum value of different intervals in the K intervals is the same. Among them, the phase quantization reference set Q K The phase quantization reference set Q may include K candidate phase quantization reference values. K For interval A subset of is the minimum phase, is the maximum phase; the K candidate phase quantization reference values ​​are arranged from small to large, and each candidate phase quantization reference value has a corresponding index value in the phase quantization reference set; among the aforementioned specified number of candidate phase quantization reference values, the intervals between any adjacent candidate phase quantization reference values ​​are the same. Exemplarily, the phase quantization reference set can be expressed as: Q K ={q1,q1,…,q K}. The second device generates a key of the second device based on the multiple quantization reference values, including: the second device determines multiple quantization results based on the index value of each quantization reference value in the multiple quantization reference values; the second device generates a key of the second device based on the multiple quantization results. Among the multiple quantization results, the length of each quantization result is b, and b is an integer greater than or equal to 2. Specifically, the second device obtains the index value of each quantization reference value in the multiple quantization reference values ​​in a manner that: the second device inputs the mth phase quantization reference value in the multiple phase quantization reference values ​​into a preset classification formula, and obtains the index value of the mth phase quantization reference value output by the preset classification formula, and the index value may refer to the index value corresponding to the mth phase quantization reference value in the phase quantization reference set. For example, the aforementioned preset classification formula may be expressed as f1(*) represents the calculation function of the preset classification formula. represents the mth phase quantization reference value, index2 represents the index value, and index2 is an integer greater than or equal to 1 and less than or equal to K. Since the method for determining the index value of each phase quantization reference value is the same as the method for determining the index value of the mth phase quantization reference value, they are not described one by one. The second device determines multiple quantization results based on the index value of each quantization reference value in the multiple quantization reference values, which may be: The second device determines the quantization value corresponding to the index value of each phase quantization reference value in the multiple phase quantization reference values ​​based on the quantization mapping relationship, and uses the quantization value corresponding to the index value of each phase quantization reference value in the multiple phase quantization reference values ​​as multiple quantization results; or, the second device inputs the index value of each phase quantization reference value in the multiple phase quantization reference values ​​into an encoder, obtains the quantization value corresponding to each phase quantization reference value output by the encoder respectively, and uses the quantization value corresponding to the index value of each phase quantization reference value in the multiple phase quantization reference values ​​as multiple quantization results. The quantization mapping relationship may include: K candidate index values, and candidate quantization values ​​corresponding to each candidate index value in the K candidate index values, and the quantization mapping relationship may be preset according to actual conditions. The encoder may be a Gramme encoder, for example, it may be expressed as g{index2}, g{*} represents the calculation function of the Gramme encoder; that is, in the method of using the encoder for processing, any quantization value may be obtained using the formula get. The manner in which the second device generates a key of the second device based on the multiple quantization results is the same as that in the aforementioned embodiment and will not be described repeatedly. In some possible implementations, the last second message carries multiple quantization offsets. The processing by the second device further includes: the second device obtains the multiple quantization offsets based on the multiple quantization reference values ​​and the multiple processed related parameters. In some embodiments, the relevant parameter is the receiving strength, and the aforementioned processed relevant parameter is specifically the processed receiving strength. Taking any one of the multiple quantization offsets of the second device as the mth quantization offset as an example, the manner in which the second device determines the mth quantization offset may include: the second device subtracts the mth processed signal strength from the mth quantization reference value to obtain the mth quantization offset. In this embodiment, the quantization reference value is specifically an intensity quantization reference value, and the quantization offset is specifically an intensity quantization offset. For example, the above processing can be expressed by the following formula: represents the mth intensity quantization offset, represents the mth processed signal strength among multiple processed signal strengths, The second device can obtain multiple intensity quantization offsets by adopting the same processing method as the mth intensity quantization offset. The multiple intensity quantization offsets can be expressed in a set form. For example, the number of the multiple intensity quantization offsets is M, and the set composed of the M intensity quantization offsets is expressed as P. T ,but in, Represents M intensity quantization offsets. In some embodiments, the relevant parameter is a phase, and the aforementioned processed relevant parameter is specifically a processed phase. Taking any one of the multiple quantization offsets of the second device as the mth quantization offset as an example, the manner in which the second device determines the mth quantization offset may include: the second device subtracts the mth processed phase from the mth quantization reference value to obtain the mth quantization offset. In this embodiment, the quantization reference value is specifically a phase quantization reference value, and the quantization offset is specifically a phase quantization offset. For example, the above processing can be expressed by the following formula: represents the mth phase quantization offset, represents the mth processed phase among multiple processed phases, represents the mth phase quantization reference value. By adopting the same processing method as the mth phase quantization offset, the second device can obtain multiple phase quantization offsets, and the multiple phase quantization offsets can be represented in a set form. In some possible implementations, taking the number of multiple first messages and multiple second messages as M as an example, since the second device needs to obtain the key after receiving M first messages, the second device carries the key in the last second message, i.e., the Mth second message. Specifically, the last second message may carry a message authentication code (MAC), which is generated based on the key of the second device. Optionally, the MAC is generated based on the key of the second device and multiple quantized offsets. The method for the second device to generate the MAC may specifically include: the second device uses a MAC algorithm to process the key of the second device and the multiple quantized offsets to obtain the MAC. For example, the aforementioned MAC can be expressed as MAC T =f2(K T ,P T ), MAC T That is, the last second message, K T represents the key of the second device, P T represents a set of M quantized offsets, f2() represents a MAC algorithm, and the MAC algorithm can be a lightweight MAC algorithm, such as any one of the SPECK and SIMON algorithms. Optionally, the MAC is generated based on the key of the second device, multiple quantization offsets, and a timestamp. The method for the second device to generate the MAC may specifically include: the second device uses a MAC algorithm to process the key of the second device, the multiple quantization offsets, and the timestamp to obtain the MAC, and the timestamp may be the time when the second device generates the MAC. For example, the aforementioned MAC may be represented as MAC T =f2(K T ,P T ,time T ), MAC T , K T , P T The description of f2() is the same as that of the above embodiment, time T Indicates a timestamp, which may be the time when the second device generates a MAC. In some possible implementations, the first device generates a verification key for the second device based on the multiple second messages and the target model, which may include: the first device obtains multiple parameter estimates based on the multiple second messages and the target model, different estimates among the multiple parameter estimates are estimates of relevant parameters of different first messages obtained by the second device; the first device determines the verification key for the second device based on the multiple parameter estimates. The first device obtains multiple parameter estimation values ​​based on the multiple second messages and the target model, including: the first device preprocesses the relevant parameters of each second message in the multiple second messages to obtain the preprocessed relevant parameters of each second message; the first device inputs the preprocessed relevant parameters of each second message into the target model to obtain the multiple parameter estimation values ​​output by the target model. The first device preprocesses relevant parameters of each second message in the multiple second messages to obtain the preprocessed relevant parameters of each second message, including: the first device determines a first standard deviation and a first average value based on the relevant parameters of each second message in the multiple second messages; the first device preprocesses the relevant parameters of each second message based on the first average value and the first standard deviation to obtain the preprocessed relevant parameters of each second message. The last second message carries multiple quantization offsets, and different quantization offsets in the multiple quantization offsets are related to related parameters of different first messages obtained by the second device. The first device determines the verification key of the second device based on the multiple parameter estimation values, including: the first device obtains multiple quantization reference estimation values ​​based on the multiple parameter estimation values ​​and the multiple quantization offsets; the first device determines multiple quantization estimation results based on the index value of each quantization reference estimation value in the multiple quantization reference estimation values; the first device obtains the verification key of the second device based on the multiple quantization estimation results. The aforementioned related parameter is the receiving strength, or the related parameter is the phase. The related parameter used by the first device to generate the verification key of the second device should be of the same type as the related parameter used by the second device to generate the key. For example, if the second device generates the key based on the receiving strength of the first message, the first device generates the verification key based on the receiving strength of the second message. If the second device generates the key based on the phase of the first message, the first device needs to generate the verification key based on the phase of each second message. In one embodiment, the aforementioned related parameter is specifically a receiving strength. The aforementioned related parameter of the first message is the receiving strength of the first message, and the related parameter of the second message is the receiving strength of the second message. The first device determines the first standard deviation and the first average value based on the relevant parameters of each second message in the multiple second messages, including: the first device determines the first standard deviation and the first average value based on the receiving strength of each second message in the multiple second messages. The first standard deviation is specifically the receiving strength standard deviation of the second message, and the first average value is specifically the receiving strength average value of the second message. The way in which the first device obtains the receiving strength of each second message is similar to the way in which the second device obtains the receiving strength of each first message, and will not be repeated. The first device preprocesses the relevant parameters of each second message based on the first average value and the first standard deviation to obtain the preprocessed relevant parameters of each second message, including: the first device divides the difference between the receiving strength of the mth second message and the average receiving strength of the second message by the standard deviation of the receiving strength of the second message to obtain the preprocessed receiving strength of the mth second message. Since the first device processes each second message in the same way as the mth second message, they are not described one by one. For example, assuming that the specific number of multiple second messages is M, and the receiving strength is represented by RSSI; the RSSI of the M second messages can form a set, represented as R represents the first device, represents a set of RSSIs of each second message measured by the first device. Assume that the average receiving strength of the second message is expressed as The standard deviation of the received strength of the second message is expressed as Then the way in which the first device obtains the preprocessed receiving strength of the mth second message can be calculated using the following formula: in, is a set consisting of pre-processed related parameters of each second message, and the pre-processed related parameter of any second message in the set is the pre-processed receiving strength of the aforementioned m-th second message. The first device inputs the preprocessed relevant parameters of each second message into the target model to obtain the multiple parameter estimation values ​​output by the target model, which can be specifically: the first device inputs the preprocessed receiving strength of each second message into the target model to obtain the multiple parameter estimation values ​​output by the target model. Here, the multiple parameter estimation values ​​can specifically be multiple receiving strength estimation values, and different receiving strength estimation values ​​in the multiple receiving strength estimation values ​​are the estimation values ​​of the receiving strengths of different first messages obtained for the second device. The above-mentioned embodiment has explained that the last second message carries multiple quantization offsets, and different quantization offsets in the multiple quantization offsets are related to the reception strength of different first messages obtained by the second device. The first device obtains multiple quantization reference estimation values ​​based on the multiple parameter estimation values ​​and the multiple quantization offsets, specifically: the first device adds the mth reception strength estimation value to the mth quantization offset to obtain the mth estimation value, and selects the mth candidate quantization estimation parameter from the multiple candidate quantization estimation parameter included in the quantization reference estimation set. In the evaluation, the one with the smallest absolute value of difference with the m-th estimation value is determined as the m-th quantization reference estimation value, the m-th quantization reference estimation value is one of the multiple quantization reference estimation values, and m is a positive integer. In this embodiment, the quantization reference estimation value may be an intensity quantization reference estimation value, the candidate quantization estimation reference value may be a candidate intensity quantization estimation reference value, and the quantization reference estimation set may be an intensity quantization reference estimation set. The processing method of the first device obtaining the mth quantization reference estimation value can be expressed by the following formula: Argmin represents the variable value when the objective function takes the minimum value. The variable is q′ and the objective function is represents the mth received strength estimation value, represents the mth quantization offset value, It means that the mth estimated value of the received strength is added to the mth quantization offset value to obtain the mth estimated value, Q' K represents the set of intensity quantization reference estimates, q'∈Q' K Represents variable q′ as Q' K A candidate intensity quantization estimate reference value in The multiple intensity quantization reference estimation values ​​finally obtained can be expressed in a set form. Since the determination method of each quantization reference estimation value is the same as the determination method of the mth intensity quantization reference estimation value, they will not be described one by one. The strength quantization reference estimate set may include K candidate strength quantization estimate reference values. The K candidate strength quantization estimate reference values ​​are arranged from small to large, and each candidate strength quantization estimate reference value has a corresponding index value in the strength quantization reference estimate set; among the aforementioned K candidate strength quantization estimate reference values, the intervals between any adjacent candidate strength quantization estimate reference values ​​are the same, that is, the K candidate strength quantization estimate reference values ​​are equally spaced. The strength quantization reference estimate set may be determined by the first device based on the multiple reception strength estimate values. The processing method for the first device to generate the strength quantization reference estimate set may include: the first device determines the maximum reception strength estimate value and the minimum reception strength estimate value from the multiple reception strength estimate values; divides K strength estimate value intervals between the maximum reception strength estimate value and the minimum reception strength estimate value; selects an intermediate estimate value in each strength estimate value interval in the K strength estimate value intervals as the K candidate strength quantization estimate reference values ​​in the strength quantization reference estimate set; wherein the difference between the maximum value and the minimum value of different strength estimate value intervals in the K strength estimate value intervals is the same. The manner in which the first device obtains the index value of each of the multiple quantization reference estimation values ​​may be as follows: the first device inputs the mth quantization reference estimation value of the multiple quantization reference estimation values ​​into a preset classification formula to obtain the index value of the mth quantization reference estimation value output by the preset classification formula, and the index value of the mth quantization reference estimation value may refer to the index value corresponding to the mth quantization reference estimation value in the quantization reference estimation set. Since the manner in which the index value of each quantization reference estimation value is determined is the same as the manner in which the index value of the mth quantization reference estimation value is determined, they are not described one by one. The first device determines multiple quantization estimation results based on the index value of each quantization reference estimation value in the multiple quantization reference estimation values, which can be: the first device determines the quantization value corresponding to the index value of each quantization reference estimation value in the multiple quantization reference estimation values ​​based on the quantization mapping relationship, and uses the quantization value corresponding to the index value of each quantization reference estimation value as multiple quantization estimation results; or, the first device inputs the index value of each quantization reference estimation value in the multiple quantization reference estimation values ​​into the encoder, obtains the quantization value corresponding to each quantization reference estimation value output by the encoder respectively, and uses the quantization value corresponding to the index value of each quantization reference estimation value in the multiple quantization reference estimation values ​​as multiple quantization estimation results. The specific description of the quantization mapping relationship is similar to that of the above-mentioned embodiment and is not repeated. The relevant description of the encoder is also similar to that of the above-mentioned embodiment and is not repeated. It should be understood that the first device and the second device obtain the quantization estimation results in the same manner, for example, the second device uses the quantization mapping relationship to determine the multiple quantization results, and accordingly, the first device also uses the quantization mapping relationship to determine the multiple quantization estimation results; if the second device uses the encoder to obtain the multiple quantization results, the first device also uses the encoder to obtain the multiple quantization estimation results. The first device obtains the verification key of the second device based on the multiple quantization reference estimation values, which may include: the first device combines the multiple quantization reference estimation values ​​to obtain the verification key of the second device. Taking the number of the aforementioned multiple quantization reference estimation values ​​as M as an example, the length of each quantization reference estimation value is b, then the verification key length of the second device is equal to M multiplied by b. Assuming b=4, M=32, the verification key of the second device should be the same as the key length of the second device, both of which are 128. In one embodiment, the aforementioned relevant parameter is specifically a phase. The aforementioned relevant parameter of the first message is the phase of the first message, and the relevant parameter of the second message is the phase of the second message. The first device determines a first standard deviation and a first average value based on relevant parameters of each second message in the plurality of second messages, including: the first device determines a first standard deviation and a first average value based on the phase of each second message in the plurality of second messages. The first standard deviation is specifically the phase standard deviation of the second message, and the first average value is specifically the phase average value of the second message. The first device preprocesses the relevant parameters of each second message based on the first average value and the first standard deviation to obtain the preprocessed relevant parameters of each second message, including: the first device divides the difference between the phase of the mth second message and the phase average value of the second message by the phase standard deviation of the second message to obtain the preprocessed phase of the mth second message. Since the first device processes each second message in the same way as the mth second message, they are not described one by one. For example, assuming that the specific number of the multiple second messages is M, the phases of the M second messages can form a set represented as R represents the first device, represents a set of phase components of each second message obtained by the first device. Assume that the average phase value of the second message is expressed as The phase standard deviation of the second message is expressed as Then the first device obtains the preprocessed phase of the mth second message, which can be calculated using the following formula: A set of preprocessed phase components for each second message. The first device inputs the preprocessed relevant parameters of each second message into the target model to obtain the multiple parameter estimation values ​​output by the target model, which can be specifically: the first device inputs the preprocessed phase of each second message into the target model to obtain the multiple parameter estimation values ​​output by the target model. Here, the multiple parameter estimation values ​​can specifically be multiple phase estimation values, and different phase estimation values ​​in the multiple phase estimation values ​​are the estimation values ​​of the phases of different first messages obtained for the second device. The last second message carries multiple quantization offsets, and different quantization offsets among the multiple quantization offsets are related to the phases of different first messages obtained by the second device. The first device obtains multiple quantization reference estimation values ​​based on the multiple parameter estimation values ​​and the multiple quantization offsets, specifically: the first device adds the mth phase estimation value to the mth quantization offset to obtain the mth estimation value, and determines the one with the smallest absolute value of the difference with the mth estimation value from the multiple candidate quantization estimation reference values ​​included in the quantization reference estimation set as the mth quantization reference estimation value, and the mth quantization reference estimation value is one of the multiple quantization reference estimation values, and m is a positive integer. In this embodiment, the quantization reference estimation value can be a phase quantization reference estimation value, the candidate quantization estimation reference value can be a candidate phase quantization estimation reference value, and the quantization reference estimation set can be a phase quantization reference estimation set. The manner in which the first device obtains the mth quantization reference estimation value may be calculated using the following formula: Argmin represents the variable value when the objective function takes the minimum value. The variable is q′ and the objective function is represents the mth phase estimate, represents the mth quantization offset value, It means that the mth phase estimation value is added to the mth quantization offset value to obtain the mth estimation value, Q' K represents the phase quantization reference estimate set, q'∈Q' K Represents variable q′ as Q' K A candidate phase quantization estimation reference value in The multiple phase quantization reference estimation values ​​finally obtained can be expressed in a set form. Since the determination method of each phase quantization reference estimation value is the same as the determination method of the mth phase quantization reference estimation value, they are not described one by one. The generation method of the phase quantization reference estimation set is similar to the above-mentioned embodiment, and may include: the first device determines the maximum phase estimation value and the minimum phase estimation value from the multiple phase estimation values; divides K phase estimation value intervals between the maximum phase estimation value and the minimum phase estimation value; selects an intermediate estimation value in each phase estimation value interval in the K phase estimation value intervals as K candidate phase quantization estimation reference values ​​in the phase quantization reference estimation set; wherein the difference between the maximum value and the minimum value of different phase estimation value intervals in the K phase estimation value intervals is the same. The method in which the first device obtains the index value of each quantization reference estimation value in the multiple quantization reference estimation values, the method in which the first device determines multiple quantization estimation results based on the index value of each quantization reference estimation value in the multiple quantization reference estimation values, and the method in which the first device obtains the verification key of the second device based on the multiple quantization reference estimation values ​​are similar to the above-mentioned embodiment, and are not repeated here. In another embodiment, the first device obtains multiple parameter estimation values ​​based on the multiple second messages and the target model, including: the first device inputs relevant parameters of each second message in the multiple second messages into the target model to obtain the multiple parameter estimation values ​​output by the target model, the target model is used to preprocess the relevant parameters of each second message to obtain the preprocessed relevant parameters of each second message, and the multiple parameter estimation values ​​are obtained based on the preprocessed relevant parameters of each second message. In this embodiment, the aforementioned related parameters may also be reception intensity or phase. After obtaining multiple parameter estimation values, the processing of obtaining the verification key of the second device by the first device is the same as that in the aforementioned embodiment, and will not be repeated. This embodiment is different from the aforementioned embodiment in that in this embodiment, the target model preprocesses the relevant parameters of each second message, and the specific manner in which the target model preprocesses the relevant parameters of each second message is the same as the manner in which the aforementioned first device preprocesses the relevant parameters of each second message, and will not be repeated. In some possible implementations, the last second message carries a message authentication code MAC, and the MAC is generated based on the key of the second device. The verification method of the first device includes: the first device generates information to be verified based on the verification key of the second device and the last second message; when the information to be verified is consistent with the MAC, determining that the verification key of the second device is consistent with the key of the second device. Here, the first device generates the information to be verified based on the verification key of the second device and the last second message, which can be specifically: the first device performs MAC calculation on the last second message based on the verification key of the second device to obtain the information to be verified. Regarding the method of MAC calculation, as long as the first device and the second device are the same, the specific processing of MAC calculation is not limited within the protection scope of this embodiment. In addition, the method may further include: determining the verification key of the second device when the information to be verified is inconsistent with the MAC. The key is inconsistent with the key of the second device. Further, it may also include: when the first device determines that the verification key of the second device is inconsistent with the key of the second device, the processing is terminated; or, when the first device determines that the verification key of the second device is inconsistent with the key of the second device, the first device re-sends multiple first messages to the second device so that the second device regenerates the key, which will not be repeated here. In some possible implementations, when the second device receives each first message among the multiple first messages, it sends a corresponding second message. Assume that the number of first messages used to generate a key is M, that is, the multiple first messages are specifically M first messages, and correspondingly, the multiple second messages are specifically M second messages. The first device sends multiple first messages to the second device, which may be: the first device periodically sends M first messages to the second device within the coherent time. Correspondingly, the second device receives multiple first messages sent by the first device, the second device generates the key of the second device based on the multiple first messages, and the second device sends multiple second messages to the first device, specifically including: when the second device receives the mth first message sent by the first device, it determines whether the first message currently received is the Mth first message, if not, modulates the mth first message to obtain the mth second message, and the second device sends the mth second message to the first device; if so, generates the key of the second device based on the M first messages, modulates the Mth first message to obtain the Mth second message, and the second device sends the Mth second message to the first device. The content carried by the Mth second message is the same as that in the above embodiment, and no repeated description is given. The mth first message is any one of the multiple first messages, and the mth second message is one of the multiple second messages. The aforementioned periodic period duration can be set according to actual conditions, such as 1 millisecond, 0.5 millisecond, or longer or shorter, which is not exhaustively listed here; the duration of the coherence time is not limited in this embodiment. In some possible examples, when the aforementioned related parameter is reception strength, the aforementioned related parameter of the first message is the reception strength of the first message, and the related parameter of the second message is the reception strength of the second message. The transmission power of each of the multiple first messages is a random transmission power. Optionally, the transmission power of each of the multiple first messages is a random transmission power; that is, the first device sends multiple first messages at a random transmission power. Taking any first message as the ath first message (a is an integer greater than or equal to 1 and less than or equal to M) as an example, the transmission power of the ath first message is represents the transmission power of the a-th first message, Indicates the maximum transmit power. Optionally, different first messages among the multiple first messages have different transmission powers. In one case, the transmission power of each first message in the multiple first messages may be preset, and the transmission powers of different first messages are different. For example, the multiple first messages are specifically M first messages, and the first device is pre-configured with M preset transmission powers, and different preset transmission powers are different. When sending the ath first message among the M first messages, the first device can select the ath preset transmission power from the M preset transmission powers as the transmission power of the ath first message. The preset method of the M preset transmission powers is not limited in this embodiment. In another case, the transmission power of each first message in the multiple first messages is randomly selected by the first device from 0 to the maximum transmission power, and the transmission powers of different first messages in the multiple first messages are different. For example, the first device randomly selects a power value from 0 to the maximum transmission power. If the power value is different from the transmission power of the a-1 first messages that have been sent, the power value is used as the transmission power of the a-th first message; if the power value is the same as any one of the transmission powers of the a-1 first messages that have been sent, a power value is randomly selected from 0 to the maximum transmission power again until a power value that is different from the transmission power of the a-1 first messages that have been sent is selected. In this example, different second messages among the multiple second messages are obtained by the second device modulating different first messages based on a reflection coefficient. In one case, the reflection coefficients corresponding to different second messages are the same. In this case, the multiple second messages may use the same reflection coefficient; the reflection coefficient may be preconfigured, and this embodiment does not limit the preset method of the reflection coefficient. Alternatively, the reflection coefficient may be based on the number of times the key is currently generated, and a candidate reflection coefficient at a corresponding position is selected from a preset coefficient set as the aforementioned reflection coefficient, and the preset coefficient set may include multiple candidate reflection coefficients. For example, if the key is currently generated for the Lth time, the second device may select the Lth candidate reflection coefficient from the preset coefficient set as the reflection coefficient corresponding to each second message in the current multiple second messages, where L is a positive integer. Alternatively, different first messages among the multiple first messages carry different reflection coefficient indication information, and the different reflection coefficient indication information is used to indicate the reflection coefficients corresponding to different second messages. The reflection coefficient indication information carried by different first messages indicates that different second messages correspond to the same reflection coefficient. Accordingly, the second device can determine the reflection coefficient corresponding to the mth second message based on the reflection coefficient indication information carried by the mth first message when receiving the mth first message sent by the first device. In another case, the reflection coefficients corresponding to different second messages may be the same or different. In this case, each second message The corresponding reflection coefficient may be selected by the second device from a preset range. Specifically, the second device may randomly select a reflection coefficient from a preset range when sending the mth second message, and the preset range may be [0, 1). In yet another case, different second messages among the multiple second messages correspond to different reflection coefficients. The reflection coefficient corresponding to each second message may be selected by the second device from a preset coefficient set. Specifically, the second device may select the candidate reflection coefficient at the mth position from the preset coefficient set as the reflection coefficient corresponding to the mth second message when sending the mth second message. For example, the following formula may be used to represent the manner in which the second device selects the reflection coefficient corresponding to the mth second message: ξ(m)∈{ξ1,ξ2,…,ξ V}, ξ(m) is the reflection coefficient corresponding to the mth second message, ξ1~ξ V It represents V candidate reflection coefficients included in the preset coefficient set, and the V candidate reflection coefficients are all different. The V candidate reflection coefficients can be uniformly distributed between [0, 1). Alternatively, the reflection coefficient corresponding to each second message may be randomly selected by the second device from a preset range. Specifically, the second device may randomly select a reflection coefficient from a preset range when sending the mth second message, and if the reflection coefficient is different from the reflection coefficient corresponding to any of the first m-1 second messages, the reflection coefficient is used as the reflection coefficient corresponding to the mth second message, otherwise, the reflection coefficient is reselected from the preset range until a reflection coefficient different from the first m-1 second messages is selected. Alternatively, different first messages among the multiple first messages carry different reflection coefficient indication information, and the different reflection coefficient indication information is used to indicate the reflection coefficients corresponding to different second messages. Among them, the reflection coefficients corresponding to different second messages are different. The second device can determine the reflection coefficient corresponding to the mth second message based on the reflection coefficient indication information carried by the mth first message when receiving the mth first message sent by the first device. This embodiment does not limit the manner in which the first device determines the reflection coefficient corresponding to each second message. Taking the number of first messages used to generate a key as M as an example, the multiple second messages are specifically M second messages. When the second device receives the mth first message sent by the first device, modulating the mth first message to obtain the mth second message may specifically include: when the second device receives the mth first message sent by the first device, determining whether the mth first message is the Mth first message, if not, modulating the mth first message with the reflection coefficient corresponding to the mth second message by adjusting the antenna impedance to obtain the mth second message; if so, modulating the Mth first message with the reflection coefficient corresponding to the Mth second message by adjusting the antenna impedance to obtain the Mth second message (i.e., the last second message), the specific description of the last second message is the same as the above embodiment, and no repetition is made. Except for the last second message, each second message in the first M-1 second messages may carry a random number, or each second message in the first M-1 second messages may carry a random number and a preamble. The length of the random number may be 16 bits, or longer or shorter, and this embodiment does not limit it. This embodiment does not limit the method for generating the random number. In addition, in this example, the MAC carried by the last second message may be generated based on the key of the second device and multiple quantized offsets. The specific method for generating the MAC is the same as that in the above embodiment and will not be described in detail. In some possible examples, when the aforementioned related parameter is a phase, the aforementioned related parameter of the first message is the phase of the first message, and the related parameter of the second message is the phase of the second message. The phase of each first message in the plurality of first messages is a random phase. Optionally, the phase of each first message in the multiple first messages is a random phase, and the random phase obeys a uniform distribution of [0, 2π]. Optionally, different first messages among the multiple first messages have different phases. In one case, the phase of each first message in the multiple first messages may be preset, and different first messages have different phases. For example, the multiple first messages are specifically M first messages, the first device is pre-configured with M preset phases, and different preset phases are different. When sending the ath first message among the M first messages, the first device may select the ath preset phase from the M preset phases as the phase of the ath first message. In another case, the phase of each first message in the multiple first messages is randomly selected by the first device from [0,2π], and the phases of different first messages in the multiple first messages are different. Take the processing of the a-th first message as an example: the first device randomly selects a phase value from [0,2π], and determines whether the phase value is the same as the phase of any one of the a-1 first messages sent before the a-th first message. If the phase value is different from the phases of the a-1 first messages that have been sent, the phase value is used as the phase of the a-th first message; otherwise, the first device reselects until a phase that is different from the phases of the a-1 first messages that have been sent is selected. In this example, different second messages among the multiple second messages carry different timestamps, and the phases of the different second messages are related to the phase of the first message. For example, suppose the mth first message s m0 (t) is expressed as f c is the carrier frequency, A is the amplitude, is the phase of the mth first message, is the phase generated by the transmission link of the first device. The mth second message is modulated to obtain the mth second message. m2 (t) is specifically expressed as α is the forward link attenuation coefficient, τ m0 represents the forward link consumption time, The first device receives the mth second message s m3 (t) can be expressed as: β represents the backward link attenuation coefficient, τ1 is the backward link consumption time, is the phase generated by the receiving link of the first device. It can be seen that the phase of the mth second message includes the phase of the mth first message and the phase generated by the sending and receiving links of the second device. Since the phases generated by the sending link and the receiving link of the second device can be considered to remain unchanged under ideal conditions, the phase of the mth second message is mainly affected by the phase of the mth first message; therefore, the first device can use I / Q demodulation to divide any second message into two paths, obtain I / Q two-path baseband signals through mixing and low-pass filtering, and parse out the phase. Taking the number of first messages used to generate a key as M as an example, the multiple second messages are specifically M second messages. When the second device receives the mth first message sent by the first device, modulating the mth first message to obtain the mth second message may specifically include: when the second device receives the mth first message sent by the first device, determining whether the mth first message is the Mth first message, if not, modulating the mth first message by adjusting the antenna impedance to obtain the mth second message; if so, modulating the Mth first message by adjusting the antenna impedance to obtain the Mth second message. Except for the last second message, each of the first M-1 second messages may carry at least one of the following information: antenna port, EPC (Electronic Product Code), phase, and timestamp. Preferably, each of the first M-1 second messages carries at least EPC and timestamp. The timestamp may specifically be the time when the second device generates the second message (for example, the time when the mth second message is generated). For example, the mth second message may carry the EPC and the time when the mth second message is generated. In addition, in this example, the MAC carried by the last second message may be generated based on the key of the second device, multiple quantization offsets, and a timestamp. The specific generation method of the MAC is the same as that in the previous embodiment and is not described in detail. In some possible implementations, before the first device sends multiple first messages to the second device, the method further includes: the first device sends a fourth message to the second device, the fourth message carrying the number of first messages used to generate the key. Correspondingly, before the second device receives multiple first messages sent by the first device, the method further includes: the second device receives the fourth message sent by the first device. The number of first messages used to generate the key can be expressed as M. The aforementioned fourth message may be a Query command. In a possible example, the Query command may be referred to as a key generation request Query command. The fourth message may also carry a timing parameter, which may be a positive number. The timing parameter is used by the second device to determine the maximum value of the count value of the counter, and the counter may specifically be a slot counter. Accordingly, after the second device receives the fourth message sent by the first device, it may also include: the second device determines the maximum value of the count value of the counter based on the timing parameter in the fourth message, and uses the maximum value as the initial value of the count value of the counter. Exemplarily, the timing parameter may be equal to 1, that is, the second device determines that the maximum value of the count value of the counter is equal to 1. The processing of the second device may also include: when the second device receives the first first message of the multiple first messages, the count value of the counter is reduced to 0. Any one of the aforementioned multiple first messages may be a QueryAdjust message, or a QueryAdjust data packet; each of the multiple first messages may carry indication information for instructing the second device to reduce the count value of the counter to zero. In some possible implementations, when the second device receives the confirmation message sent by the first device and determines that the key verification of the second device has passed, the method may further include: the second device sends a fifth message to the first device, the fifth message being a response message to the confirmation message, and the fifth message carrying the key K of the second device T The encrypted target designation information includes at least the EPC of the second device. The length of the fifth message may be 135 bits, or may be longer or shorter, which is not limited here. In addition to the EPC of the second device, the target designation information may also include other content, which is not exhaustive here. After the second device sends the fifth message to the first device, the second device enters the Access phase and then further enters the Acknowledge phase. Correspondingly, after the first device sends the confirmation message to the second device, it may also include: when the first device receives the fifth message, the first device enters the Access phase and then further enters the Acknowledge phase. This embodiment does not limit the specific processing of the aforementioned Access phase and Acknowledge phase. In conjunction with FIG6 , taking the relevant parameter as reception intensity, the number of multiple first messages and multiple second messages being M, the first device being a reader / writer, and the second device being a tag as an example, an exemplary description of the aforementioned key generation method is given, specifically including: S601, the reader / writer sends M first messages to the tag; S602, the tag reflects the first M-1 second messages to the reader / writer; S603, when the tag receives the Mth first message, the tag processes the reception intensity of each first message in the M first messages to obtain M processed reception intensity; S604, the tag obtains multiple quantization reference values ​​based on the M processed reception intensity, performs quantization based on the multiple quantization reference values, and generates a tag. The tag sends the Mth second message (i.e., the last second message) to the reader; S606. The reader preprocesses the receiving strength of each of the M second messages to obtain the preprocessed receiving strength of each second message; S707. The reader inputs the preprocessed receiving strength of each second message into the target model to obtain the multiple parameter estimation values ​​output by the target model; S608. The reader performs quantization based on the multiple parameter estimation values ​​to determine the verification key of the tag; S609. The reader performs consistency check on the verification key of the tag and the key of the tag, and sends a confirmation message to the tag when the two are consistent. In conjunction with FIG7 , taking the relevant parameter as receiving strength (specifically RSSI), the number of the plurality of first messages and the plurality of second messages being M, the first device being a reader / writer, and the second device being a tag as an example, another exemplary description of the aforementioned key generation method is given: S701: The reader sends a Query command to the tag, the Query command carrying the number of the first message used to generate the key. The Query command may also carry a timing parameter. The Query command is specifically the fourth message of the aforementioned embodiment, and its specific description is not repeated here. S702: The tag receives a Query command sent by the reader and initializes a time slot counter. The time slot counter may be initialized to set the maximum value of the time slot counter to 1. The specific processing of the tag is the same as that in the above embodiment and will not be described repeatedly. S703, the reader sends M first messages at a random transmission power. In FIG7 , in order to illustrate that the reader sends M first messages at a random transmission power, S703 is represented as the reader sending the first first message at a random transmission power to the reader sending the M-1 first message at a random transmission power, and the reader sending the M first message at a random transmission power. Each of the M first messages can specifically be a QueryAdjust command. Accordingly, when the tag receives each first message in the first M-1 first messages, it modulates each first message sent by the reader with a reflection coefficient ξ(m) by adjusting the antenna impedance, and backscatters each second message. In FIG7 , in order to illustrate that the tag sends the first M-1 second messages respectively, it is represented as the tag sending the first second message to the tag sending the M-1 second message. S704: When the tag receives the Mth first message, the tag generates a key based on the reception strength of each first message. Here, the specific process of the tag generating the key has been described in detail in the above embodiment and will not be repeated. S705. The tag sends the last second message to the reader. The last second message may be the Mth second message. The last second message may carry a MAC, which may be generated based on the tag's key and multiple quantized offsets. The specific generation method of the MAC is the same as that in the previous embodiment, and will not be repeated. S706: The reader / writer preprocesses the receiving strength of each second message in the M second messages to obtain the preprocessed receiving strength of each second message. S707. The reader / writer inputs the preprocessed receiving strength of each second message into the target model to obtain M parameter estimation values ​​output by the target model. S708. The reader / writer determines the tag verification key based on the M parameter estimation values. S709, the reader determines whether the tag's verification key is consistent with the tag's key. If they are consistent, S710 is executed; if not, an error (Error) mark is sent and the processing ends. After sending the error (Error) mark, no further processing is required; or, the process may return to S701. S710. The reader sends a confirmation message to the tag, where the confirmation message is used to indicate that the key verification of the tag has passed. S711. The tag sends a fifth message to the reader / writer, wherein the fifth message carries the EPC encrypted by the tag's key. Further in conjunction with the scenario diagram shown in FIG8 , the transmission power of the reader to send any first message is represented by the RSSI in FIG8 CW; In FIG8 , the receiving strength of the tag receiving the first message is represented as RSSI T , the Tag sends multiple second messages to the Reader; the reception strength of any second message sent by the Tag on the Reader side is represented by the RSSI in FIG8 R Although the eavesdropper (Eve) can monitor the strength of any first message (such as RSSI in FIG8 ), R,E ), and the strength of any second message sent by the Tag (such as RSSI in FIG. 8 ), T,E ), but because the eavesdropper does not have the channel diversity between each tag and the reader, and the eavesdropper does not have a pre-set target model, the eavesdropper cannot accurately estimate the receiving strength of the tag, and thus cannot obtain the key of the tag. It can be seen that the solution provided in this embodiment can ensure the security of the key between the reader and the tag. In conjunction with FIG9 , taking the relevant parameter as phase, the number of the plurality of first messages and the plurality of second messages as M, the first device as a reader / writer, and the second device as a tag as an example, another exemplary description of the aforementioned key generation method is given: S901. The reader sends a Query command to the tag. The Query command carries the number of the first message used to generate a key. S902: The tag receives a Query command sent by the reader and initializes a time slot counter. S901 to S902 are the same as the aforementioned S701 to S702 and will not be described repeatedly. S903, the reader sends M first messages at a random phase. In FIG9 , in order to illustrate that the reader sends M first messages at a random phase, S903 is represented as the reader sending the 1st first message at a random phase ~ the reader sending the M-1th first message at a random phase, and the reader sending the Mth first message at a random phase. Each of the M first messages can specifically be a QueryAdjust command. Accordingly, when the tag receives each first message in the first M-1 first messages, it modulates each first message sent by the reader by adjusting the antenna impedance, and backscatters each second message. In FIG9 , in order to illustrate that the tags are respectively Sending the first M-1 second messages means that the tag sends the first second message to the tag sends the M-1 second message. Each of the aforementioned M-1 second messages may carry a timestamp and an EPC. S904: When the tag receives the Mth first message, the tag generates a key of the tag based on the phase of each first message. Here, the specific process of the tag generating the key has been described in detail in the above embodiment and will not be repeated. S905. The tag sends the last second message to the reader. The last second message may be the Mth second message. The last second message may carry a MAC, which may be generated based on the tag's key, multiple quantization offsets, and a timestamp. The specific generation method of the MAC is the same as that in the previous embodiment, and will not be repeated. S906. The reader / writer preprocesses the phase of each second message in the M second messages to obtain the preprocessed phase of each second message. S907. The reader / writer inputs the preprocessed phase degree of each second message into the target model to obtain M parameter estimation values ​​output by the target model. S908. The reader / writer determines the tag verification key based on the M parameter estimation values. S909, the reader determines whether the tag's verification key is consistent with the tag's key. If they are consistent, S910 is executed; if not, an error (Error) mark is sent and the processing ends. After sending the error (Error) mark, no further processing may be performed; or, the process may return to S901. S910. The reader sends a confirmation message to the tag, where the confirmation message is used to indicate that the key verification of the tag has passed. S911. The tag sends a fifth message to the reader / writer, wherein the fifth message carries the EPC encrypted by the tag's key. In some possible implementations, the target model may be stored in the first device after being trained on other devices. Alternatively, the target model may be obtained by training on the first device. Here, the target model may be a trained model, and the target model may also be referred to as a target neural network; the type of the target neural network may specifically be a supervised deep neural network, for example, a fully connected network, a recurrent neural network (RNN), a long short-term memory network (LSTM), etc., and all possible types are not enumerated here. Taking LTSM as an example, LSTM adds a unit state to RNN to save long-term state. The LSTM model training process adopts the time-based back-propagation algorithm (BPTT) similar to the principle of the classic back-propagation (BP) algorithm. The LSTM training process can include: calculating the output value of the LSTM cell; reversely calculating the error term of each LSTM cell; calculating the gradient of each weight according to the corresponding error term; updating the weight based on the gradient optimization algorithm. Referring to Figure 10, the multiple layers contained in LSTM and the flow of input and output information are explained: the input information first enters the input layer, and the information is sent to the LSTM hidden layer 1 through the input layer. The data output by the LSTM hidden layer 1 enters the Dropout (random deactivation) layer, and the Dropout layer inputs the processed data into the LSTM hidden layer 2 for processing. The data processed by the LSTM hidden layer 2 is input into the Dense (dense) layer, and the Dense layer obtains the output information. Among them, the Dropout layer is used to prevent overfitting; the Dense layer is also the output layer, which is used to realize the regression process of extracting feature information. In this embodiment, the feature information extracted by the Dense layer can be the receiving intensity or phase; the number of neurons in the LSTM hidden layer 1 and the LSTM hidden layer 2 can be 128. In some possible implementations, the aforementioned target model is obtained by training the first device. As for the time when the first device obtains the target model through training, as long as it is before the first device sends multiple first messages to the second device, it is within the protection scope of this embodiment. The processing of the first device may include: the first device trains a preset model based on training data to obtain the target model, and the training data is related to the following parameters: relevant parameters of each of the multiple third messages sent by the first device obtained by the second device, and relevant parameters of each of the multiple reflection messages sent by the second device obtained by the first device, and different reflection messages in the multiple reflection messages are related to different third messages. In one example, the aforementioned related parameter is the receiving strength. The aforementioned related parameter of the third message is the receiving strength of the third message, and the related parameter of the reflected message is the receiving strength of the reflected message. The aforementioned training data may include: the receiving strength of each third message among multiple third messages sent by the first device obtained by the second device, and the receiving strength of each reflected message among multiple reflected messages sent by the second device obtained by the first device. The method for acquiring the training data may include: the first device sends a plurality of third messages to the second device; the first device receives a plurality of reflected messages sent by the second device, different reflected messages in the plurality of reflected messages correspond to different third messages, and each reflected message carries the receiving strength of the third message corresponding to the reflected message; the first device measures the receiving strength of each reflected message in the plurality of reflected messages, and obtains the receiving strength of each third message measured by the second device from each reflected message; the first device uses the receiving strength of each third message in the plurality of third messages sent by the first device obtained by the second device and the receiving strength of each reflected message in the plurality of reflected messages sent by the second device obtained by the first device as the training data. Accordingly, the processing of the second device may include: the second device receives a plurality of third messages sent by the first device, and measures the receiving strength of each third message; the second device sends a plurality of reflected messages to the first device, different reflected messages in the plurality of reflected messages are obtained by the second device reflecting different second messages by adjusting the antenna impedance, and each reflected message carries the receiving strength of the third message corresponding to the reflected message. The first device trains the preset model based on the training data to obtain the target model, which may include: the first device uses the receiving intensity of each third message and the receiving intensity of each reflected message as the training data of the preset model to obtain the trained target model. The loss function of the preset model is defined as the mean square error function (MSE), which can be specifically expressed as: N represents the batch data size, represents the predicted i-th intensity estimate, represents the actual measured receiving strength of the third message of the ith time. In each training, the algorithm is used to minimize the loss function MSE. It should also be noted that before the first device sends multiple third messages to the second device, it may also include: the first device sends a first command to the second device, the first command carries the number D of third messages, D is an integer greater than or equal to 2; the first command may also carry a timing parameter, the timing parameter is used for the second device to set the count value of the time slot counter to 1. Correspondingly, after receiving the first command, the second device may also set the count value of its own time slot counter to 1. In addition, each of the aforementioned third messages may also be used to instruct the second device to set the count value of the time slot counter to 0. Taking the first device as a reader and the second device as a tag as an example, an exemplary description of the above model training method is given: the reader sends a first command to the tag; the tag receives the first command, initializes the time slot counter, that is, selects time slot 1 to load into the slot counter; the reader sends D third messages within the coherent time; each time the tag receives a third message, it measures the receiving strength of the third message and sends a reflection message of the third message, which carries the receiving strength of the third message; the reader measures the receiving strength of each reflected message in the D reflection messages, and uses the receiving strength of each reflected message and the receiving strength of each third message as training data to train the preset model, and obtain the trained target model. The above receiving strength can specifically be RSSI. Taking the first device as a reader and the second device as a tag as an example, another exemplary description of the above model training method is given. The processing of the tag in this example is the same as the previous example, and no repeated description is given. The difference from the previous example is that the reader measures the receiving intensity of each reflected message in D reflected messages, preprocesses the receiving intensity of each reflected message, and obtains the preprocessed receiving intensity of each reflected message; the reader uses the preprocessed receiving intensity of each reflected message and the receiving intensity of each third message as training data to train the preset model. The above method of preprocessing the receiving intensity of the reflected message is the same as the method of preprocessing the receiving intensity of each second message in the previous embodiment, and no repeated description is given. In one example, the aforementioned related parameter is a phase. The aforementioned related parameter of the third message is the phase of the third message, and the related parameter of the reflected message is the phase of the reflected message. The aforementioned training data may include: the phase of each third message among multiple third messages sent by the first device obtained by the second device, and the phase of each reflected message among multiple reflected messages sent by the second device obtained by the first device. The way in which the first device obtains training data in this example is similar to that in the previous example, except that the training data includes the phase of each reflected message and the phase of each third message measured by the second device. The loss function used in this example is also similar to that in the previous example, except that the loss function is also calculated based on the predicted phase and the phase of the third message actually measured by the second device. For example, the loss function in this example is expressed as MSE', and its calculation method can be: N represents the batch data size, represents the predicted i-th phase estimate, The phase of the i-th third message actually measured by the second device is used to minimize the loss function MSE' using the algorithm in each training. Taking the first device as a reader / writer and the second device as a tag as an example, an exemplary explanation of the above-mentioned model training method is given. The processing flow of this example is the same as the previous example, except that the reflection message carries the phase, timestamp and EPC of the third message measured by the tag; the reader / writer needs to measure the phase of each of the D reflection messages, and use the phase of each reflection message and the phase of the third message carried in each reflection message as training data. Next, combined with the simulation results, taking the first device as a reader / writer and the second device as a tag as an example, the key generation method provided in this embodiment is described: Assume that the length of the quantization result of the tag for each first message (or the reader for each second message) is b, b is equal to 4, the key length required for quantization is 128 bits, the distance between the reader and the tag is 1 meter, the reader antenna gain is 3dB, the tag antenna gain is 2dB, and the tag backscatter loss is 5dB; the reader random transmission power range is 23dBm to 30dBm. Assume that the target model is LSTM, the maximum number of training iterations is 250, and the training optimization algorithm is Adam (Adaptive Moment Estimation). As shown in Figure 11, when the number of training iterations reaches more than 100, the RMSE (Root mean squared error) is close to less than 0.1 and the loss is close to zero, so LSTM converges faster and has better fitting performance. In the actual simulation, the estimated value of the receiving strength (specifically RSSI) of the tag obtained by the reader using other solutions and the estimated value of the RSSI of the tag obtained by the reader using the solution provided by this embodiment are compared with the actual measured receiving strength of the tag. It can be concluded that the actual measured receiving strength of the tag is similar to the estimated value of the RSSI of the tag obtained by the reader using the solution provided by this embodiment. The simulation results show that there is a large deviation between the estimated RSSI of the tag using other schemes and the receiving strength actually measured by the tag. This shows that the scheme of this embodiment can eliminate the influence of inconsistent sequences at both ends of the channel due to system noise, estimation errors, etc., and realize the channel reciprocity required for physical layer key generation. The key inconsistency rate is defined as the ratio of the number of different bits in the keys of both parties to the total number of bits extracted in the quantization stage. Figure 12 shows the relationship between the key bit error rate and the signal-to-noise ratio under different schemes. When the signal-to-noise ratio SNR is 50dB, the key inconsistency rate of both parties in the scheme provided by this embodiment is lower than 0.01, that is, the key consistency rate of both parties can reach more than 99.6%; the eavesdropper's key inconsistency rate is around 0.47, indicating that the eavesdropper can hardly obtain any key information; although the key inconsistency rate of both parties obtained by other schemes is also lower than 0.05, it is significantly higher than the key inconsistency rate of both parties in the scheme provided by this embodiment. It can be seen that the scheme provided by this embodiment is significantly better than the traditional channel estimation scheme. Finally, still taking the first device as the reader, the second device as the tag, and the related parameter as the receiving strength as an example, the beneficial effects of the scheme provided by this embodiment are analyzed: the reader transmits a continuous carrier with random power, and the eavesdropper does not know the transmission power, so the source entropy of the key generation is enhanced; because the channel has short-term reciprocity and adopts a multi-level quantization scheme based on negotiation, the reader and the tag can obtain a consistent key pair, while the eavesdropper cannot obtain the key due to different channels. In addition, since the reader uses the target model for estimation in the scheme provided by this embodiment, the influence of the inconsistency of the sequence at both ends of the channel caused by actual system noise, errors, etc. is eliminated, the consistency of key generation is improved, and the robustness problem of key generation is solved. In addition, the scheme provided by this embodiment uses a multi-level quantization method, which can use the tag to send a quantization offset on a public channel to correct the deviation, thereby reducing the number of key negotiations and reducing signaling overhead. Finally, the scheme provided by this embodiment only needs to complete operations such as received signal strength measurement and quantization at the tag, and puts the computationally intensive work such as deep learning at the reader end, so it is suitable for zero-power devices. In the key generation method provided in this embodiment, the first device sends multiple first messages, which are used to generate keys for the second device, and the first device receives multiple second messages sent by the second device, and the last second message in the multiple second messages carries the key of the second device; the first device generates a verification key based on the multiple second messages and the target model, and sends a confirmation message when it is determined that the verification key is consistent with the key. In this way, since the key of the second device is generated based on multiple first messages, and the verification key obtained by the first device is generated based on multiple second messages, the randomness of key generation can be guaranteed, thereby ensuring the security of the key; in addition, since the verification key is generated by the first device based on multiple second messages and the target model, the efficiency of the first device in generating the verification key can be guaranteed; due to the short-term mutual difference of the channel between the first device and the second device, the consistency of the verification key obtained by the first device and the key obtained by the second device can also be guaranteed. FIG13 is a schematic diagram of the composition structure of a first device according to an embodiment of the present application, including: The first communication unit 1301 is configured to send multiple first messages to a second device, where different first messages in the multiple first messages occupy different time domain ranges, and the multiple first messages are used for the second device to generate a key; receive multiple second messages sent by the second device, where different second messages in the multiple second messages are related to different first messages, and the last second message in the multiple second messages carries the key of the second device; The first processing unit 1302 is used to generate a verification key for the second device based on the multiple second messages and the target model, and send a confirmation message to the second device through the first communication unit when the verification key of the second device is consistent with the key of the second device. The first processing unit is used to obtain a plurality of parameter estimation values ​​based on the plurality of second messages and the target model, wherein different parameter estimation values ​​among the plurality of parameter estimation values ​​are estimation values ​​of relevant parameters of different first messages obtained by the second device; and determine a verification key for the second device based on the plurality of parameter estimation values. The first processing unit is used to preprocess the relevant parameters of each second message in the multiple second messages to obtain the preprocessed relevant parameters of each second message; input the preprocessed relevant parameters of each second message into the target model to obtain the multiple parameter estimation values ​​output by the target model. The first processing unit is used to determine a first standard deviation and a first average value based on relevant parameters of each second message in the multiple second messages; preprocess the relevant parameters of each second message based on the first average value and the first standard deviation to obtain the preprocessed relevant parameters of each second message. The first processing unit is used to input relevant parameters of each second message in the multiple second messages into the target model to obtain the multiple parameter estimation values ​​output by the target model. The target model is used to preprocess the relevant parameters of each second message to obtain the preprocessed relevant parameters of each second message, and obtain the multiple parameter estimation values ​​based on the preprocessed relevant parameters of each second message. The last second message carries multiple quantization offsets, and different quantization offsets among the multiple quantization offsets are related to relevant parameters of different first messages obtained by the second device; the first processing unit is used to obtain multiple quantization reference estimation values ​​based on the multiple parameter estimation values ​​and the multiple quantization offsets; determine multiple quantization estimation results based on the index value of each quantization reference estimation value among the multiple quantization reference estimation values; and obtain the verification key of the second device based on the multiple quantization estimation results. The first processing unit is used to train the preset model based on the training data to obtain the target model, and the training data and The following parameters are related: relevant parameters of each third message among multiple third messages sent by the first device obtained by the second device, and relevant parameters of each reflected message among multiple reflected messages sent by the second device obtained by the first device, and different reflected messages among the multiple reflected messages are related to different third messages. The related parameters include receiving strength and phase. The transmission power of each first message in the multiple first messages is a random transmission power. Different second messages among the multiple second messages are obtained by the second device modulating different first messages based on a reflection coefficient. Different second messages among the multiple second messages correspond to different reflection coefficients. Different first messages among the multiple first messages carry different reflection coefficient indication information, and the different reflection coefficient indication information is used to indicate reflection coefficients corresponding to different second messages. The phase of each first message in the multiple first messages is a random phase. Different second messages among the multiple second messages carry different timestamps, and phases of the different second messages are related to the phase of the first message. The last second message carries a message authentication code MAC, and the MAC is generated based on the key of the second device; the first processing unit is used to generate information to be verified based on the verification key of the second device and the last second message; when the information to be verified is consistent with the MAC, it is determined that the verification key of the second device is consistent with the key of the second device. The first communication unit is used to send a fourth message to the second device, where the fourth message carries the number of the first message used to generate the key. The first device is a first terminal or a first network device; the second device is a zero-power consumption device. FIG14 is a schematic diagram of the composition structure of a first device according to an embodiment of the present application, including: The second communication unit 1401 is configured to receive multiple first messages sent by a first device, where different first messages in the multiple first messages occupy different time domain ranges; send multiple second messages to the first device, where different second messages in the multiple second messages are related to different first messages, and the last second message in the multiple second messages carries a key of the second device; The second processing unit 1402 is configured to generate a key for the second device based on the multiple first messages; and determine that the key verification of the second device has passed when a confirmation message sent by the first device is received through the second communication unit. The second processing unit is used to obtain a second average value and a second standard deviation based on relevant parameters of each first message in the multiple first messages; obtain a plurality of processed relevant parameters based on the second average value, the second standard deviation and relevant parameters of each first message; obtain a plurality of quantized reference values ​​based on the plurality of processed relevant parameters; and generate a key of the second device based on the plurality of quantized reference values. The second processing unit is used to determine, based on multiple candidate quantization reference values, a candidate quantization reference value with the smallest difference from the mth processed related parameter as the mth quantization reference value, the multiple candidate quantization reference values ​​are determined based on the related parameters of each first message, the mth processed related parameter is one of the multiple processed related parameters, the mth quantization reference value is one of the multiple quantization reference values, and m is a positive integer. The second processing unit is configured to determine a plurality of quantization results based on an index value of each quantization reference value in the plurality of quantization reference values; and generate a key of the second device based on the plurality of quantization results. The last second message carries multiple quantization offsets; the second processing unit is used to obtain the multiple quantization offsets based on the multiple quantization reference values ​​and the multiple processed related parameters. The related parameter is the receiving strength. The related parameter is the phase. The transmission power of each first message in the multiple first messages is a random transmission power. Different second messages among the multiple second messages are obtained by the second device modulating different first messages based on a reflection coefficient. Different second messages among the multiple second messages correspond to different reflection coefficients. Different first messages among the multiple first messages carry different reflection coefficient indication information, and the different reflection coefficient indication information is used to indicate reflection coefficients corresponding to different second messages. The phase of each first message in the multiple first messages is a random phase. Different second messages among the multiple second messages carry different timestamps, and phases of the different second messages are related to the phase of the first message. The last second message carries a message authentication code MAC, and the MAC is generated based on the key of the second device. The second communication unit is used to receive a fourth message sent by the first device, where the fourth message carries the number of the first message used to generate the key. The first device is a first terminal or a first network device; the second device is a zero-power consumption device. The first device and the second device of the embodiment of the present application can realize the corresponding functions of the first device and the second device in the aforementioned key generation method embodiment. The corresponding processes, functions, implementation methods and beneficial effects of each module (submodule, unit or component, etc.) in the first device and the second device can be found in the corresponding description in the above method embodiment, which will not be repeated here. The functions described by the modules (sub-modules, units or components, etc.) in the first device and the second device may be implemented by different modules (sub-modules, units or components, etc.) or by the same module (sub-module, unit or component, etc.). FIG. 15 is a schematic structural diagram of a communication device 1500 according to an embodiment of the present application. The communication device 1500 includes a processor 1510, and the processor 1510 can call and run a computer program from a memory so that the communication device 1500 implements the method in the embodiment of the present application. In a possible implementation, the communication device 1500 may also include a memory 1520. Among them, the processor 1510 can call and run a computer program from the memory 1520 so that the communication device 1500 implements the method in the embodiment of the present application. Among them, the memory 1520 can be a separate device independent of the processor 1510, or it can be integrated in the processor 1510. In a possible implementation, the communication device 1500 may also include a transceiver 1530, and the processor 1510 can control the transceiver 1530 to communicate with other devices, specifically, it can send information or data to other devices, or receive information or data sent by other devices. Among them, the transceiver 1530 may include a transmitter and a receiver. The transceiver 1530 may further include an antenna, and the number of antennas may be one or more. In a possible implementation, the communication device 1500 may be the first device of the embodiment of the present application, and the communication device 1500 may implement the corresponding process implemented by the first device in each method of the embodiment of the present application, and for the sake of brevity, it is not repeated here. In a possible implementation, the communication device 1500 may be the second device of the embodiment of the present application, and the communication device 1500 may implement the corresponding process implemented by the second device in each method of the embodiment of the present application, and for the sake of brevity, it is not repeated here. FIG16 is a schematic structural diagram of a chip 1600 according to an embodiment of the present application. The chip 1600 includes a processor 1610, and the processor 1610 can call and run a computer program from a memory to implement the method in the embodiment of the present application. In a possible implementation, the chip 1600 may also include a memory 1620. Among them, the processor 1610 can call and run a computer program from the memory 1620 to implement the method performed by the first device or the second device in the embodiment of the present application. Among them, the memory 1620 can be a separate device independent of the processor 1610, or it can be integrated in the processor 1610. In a possible implementation, the chip 1600 may also include an input interface 1630. Among them, the processor 1610 can control the input interface 1630 to communicate with other devices or chips, specifically, it can obtain information or data sent by other devices or chips. In a possible implementation, the chip 1600 may also include an output interface 1640. The processor 1610 may control the output interface 1640 to communicate with other devices or chips, and specifically, may output information or data to other devices or chips. In one possible implementation, the chip can be applied to the first device in the embodiment of the present application, and the chip can implement the corresponding process implemented by the first device in each method of the embodiment of the present application, which will not be described in detail here for the sake of brevity. In one possible implementation, the chip can be applied to the second device in the embodiment of the present application, and the chip can implement the corresponding process implemented by the second device in each method of the embodiment of the present application, which will not be described in detail here for the sake of brevity. The chips applied to the first device and the second device can be the same chip or different chips. It should be understood that the chip mentioned in the embodiment of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc. The processor mentioned above can be a general-purpose processor, a digital signal processor (digital signal processor, DSP), a field programmable gate array (field programmable gate array, FPGA), an application specific integrated circuit (application specific integrated circuit, ASIC) or other programmable logic devices, transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor mentioned above can be a microprocessor or any conventional processor, etc. The memory mentioned above can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM). It should be understood that the above-mentioned memory is an exemplary but not restrictive description. For example, the memory in the embodiment of the present application can also be a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DR RAM), etc.That is, the memory in the embodiments of the present application is intended to include but is not limited to these and any other suitable types of memory. FIG17 is a schematic block diagram of a communication system 1700 according to an embodiment of the present application. The communication system 1700 includes a first device 1710 and a second device 1720. The first device 1710 can be used to implement the corresponding functions implemented by the first device in the above method. The second device 1720 can be used to implement the corresponding functions implemented by the second device in the above method. For the sake of brevity, it is not repeated here. In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function in accordance with the embodiment of the present application is generated in whole or in part. 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 computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) The computer readable storage medium can be any available medium that can be accessed by the computer or a data storage device such as a server or a data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)). It should be understood that in various embodiments of the present application, the size of the sequence number of each process does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. The above is only a specific implementation method of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claim.

Claims

1. A key generation method, comprising: The first device sends a plurality of first messages to the second device, wherein different first messages in the plurality of first messages occupy different time domain ranges, and the plurality of first messages are used for the second device to generate a key; The first device receives a plurality of second messages sent by the second device, where different second messages in the plurality of second messages are related to different first messages, and the last second message in the plurality of second messages carries a key of the second device; The first device generates a verification key for the second device based on the plurality of second messages and a target model; When the verification key of the second device is consistent with the key of the second device, the first device sends a confirmation message to the second device.

2. The method according to claim 1, wherein: The first device generates a verification key for the second device based on the multiple second messages and the target model, including: The first device obtains a plurality of parameter estimation values ​​based on the plurality of second messages and the target model, wherein different parameter estimation values ​​among the plurality of parameter estimation values ​​are estimation values ​​of relevant parameters of different first messages obtained by the second device; The first device determines a verification key for the second device based on the plurality of parameter estimates.

3. The method according to claim 2, wherein: The first device obtains a plurality of parameter estimation values ​​based on the plurality of second messages and the target model, including: The first device preprocesses relevant parameters of each second message in the multiple second messages to obtain the preprocessed relevant parameters of each second message; The first device inputs the preprocessed relevant parameters of each second message into the target model to obtain the multiple parameter estimation values ​​output by the target model.

4. The method according to claim 3, wherein: The first device preprocesses the relevant parameters of each second message in the multiple second messages to obtain the preprocessed relevant parameters of each second message, including: The first device determines a first standard deviation and a first average value based on relevant parameters of each second message in the plurality of second messages; The first device preprocesses the relevant parameters of each second message based on the first average value and the first standard deviation to obtain the preprocessed relevant parameters of each second message.

5. The method according to claim 2, wherein: The first device obtains a plurality of parameter estimation values ​​based on the plurality of second messages and the target model, including: The first device inputs relevant parameters of each second message in the multiple second messages into the target model to obtain the multiple parameter estimation values ​​output by the target model. The target model is used to preprocess the relevant parameters of each second message to obtain the preprocessed relevant parameters of each second message, and obtain the multiple parameter estimation values ​​based on the preprocessed relevant parameters of each second message.

6. The method according to any one of claims 2 to 5, wherein: The last second message carries multiple quantization offsets, and different quantization offsets in the multiple quantization offsets are related to relevant parameters of different first messages obtained by the second device; The first device determines the verification key of the second device based on the multiple parameter estimation values, including: the first device obtains multiple quantization reference estimation values ​​based on the multiple parameter estimation values ​​and the multiple quantization offsets; the first device determines multiple quantization estimation results based on the index value of each quantization reference estimation value in the multiple quantization reference estimation values; the first device obtains the verification key of the second device based on the multiple quantization estimation results.

7. The method according to any one of claims 1 to 6, wherein: The method further comprises: The first device trains a preset model based on training data to obtain the target model, and the training data is related to the following parameters: relevant parameters of each third message in multiple third messages sent by the first device obtained by the second device, and relevant parameters of each reflected message in multiple reflection messages sent by the second device obtained by the first device, and different reflected messages in the multiple reflection messages are related to different third messages.

8. The method according to any one of claims 2 to 7, wherein: The relevant parameters include reception strength.

9. The method according to any one of claims 2 to 7, wherein: The relevant parameters include phase.

10. The method according to claim 8, wherein: The transmission power of each first message in the multiple first messages is a random transmission power.

11. The method according to claim 10, wherein: Different second messages among the multiple second messages are obtained by the second device modulating different first messages based on a reflection coefficient.

12. The method according to claim 11, wherein: Different second messages among the multiple second messages correspond to different reflection coefficients.

13. The method according to claim 11 or 12, wherein: Different first messages among the multiple first messages carry different reflection coefficient indication information, and the different reflection coefficient indication information is used to indicate reflection coefficients corresponding to different second messages.

14. The method according to claim 9, wherein: The phase of each first message in the multiple first messages is a random phase.

15. The method according to claim 14, wherein: Different second messages among the multiple second messages carry different timestamps, and phases of the different second messages are related to the phase of the first message.

16. The method according to any one of claims 1 to 15, wherein: The last second message carries a message authentication code MAC, where the MAC is generated based on the key of the second device; The method also includes: the first device generates information to be verified based on the verification key of the second device and the last second message; and when the information to be verified is consistent with the MAC, determining that the verification key of the second device is consistent with the key of the second device.

17. The method according to any one of claims 1 to 16, wherein: The method further comprises: The first device sends a fourth message to the second device, where the fourth message carries the number of the first message used to generate the key.

18. The method according to any one of claims 1 to 17, wherein: The first device is a first terminal or a first network device; the second device is a zero-power consumption device.

19. A key generation method, comprising: The second device receives multiple first messages sent by the first device, where different first messages in the multiple first messages occupy different time domain ranges; The second device generates a key of the second device based on the plurality of first messages; The second device sends a plurality of second messages to the first device, different second messages in the plurality of second messages are related to different first messages, and the last second message in the plurality of second messages carries a key of the second device; When the second device receives the confirmation message sent by the first device, it determines that the key verification of the second device has passed.

20. The method according to claim 19, wherein: The second device generates a key of the second device based on the plurality of first messages, including: The second device obtains a second average value and a second standard deviation based on relevant parameters of each first message in the plurality of first messages; The second device obtains a plurality of processed related parameters based on the second average value, the second standard deviation, and the related parameters of each first message; The second device obtains a plurality of quantization reference values ​​based on the plurality of processed related parameters; The second device generates a key of the second device based on the plurality of quantization reference values.

21. The method according to claim 20, wherein: The second device obtains a plurality of quantization reference values ​​based on the plurality of processed related parameters, including: The second device determines, based on multiple candidate quantization reference values, a candidate quantization reference value with the smallest difference from the mth processed related parameter as the mth quantization reference value, the multiple candidate quantization reference values ​​are determined based on the related parameters of each first message, the mth processed related parameter is one of the multiple processed related parameters, the mth quantization reference value is one of the multiple quantization reference values, and m is a positive integer.

22. The method according to claim 20 or 21, wherein: The second device generates a key of the second device based on the multiple quantization reference values, including: The second device determines a plurality of quantization results based on an index value of each quantization reference value in the plurality of quantization reference values; The second device generates a key of the second device based on the multiple quantization results.

23. The method according to any one of claims 20 to 22, wherein: The last second message carries multiple quantization offsets; the method also includes: The second device obtains the multiple quantization offsets based on the multiple quantization reference values ​​and the multiple processed related parameters.

24. The method according to any one of claims 20 to 23, wherein: The relevant parameter is reception strength.

25. The method according to any one of claims 20 to 23, wherein: The relevant parameter is the phase.

26. The method according to claim 24, wherein: The transmission power of each first message in the multiple first messages is a random transmission power.

27. The method according to claim 26, wherein: Different second messages among the multiple second messages are obtained by the second device modulating different first messages based on a reflection coefficient.

28. The method according to claim 27, wherein: Different second messages among the multiple second messages correspond to different reflection coefficients.

29. The method according to claim 27 or 28, wherein: Different first messages among the multiple first messages carry different reflection coefficient indication information, and the different reflection coefficient indication information is used to indicate reflection coefficients corresponding to different second messages.

30. The method of claim 25, wherein: The phase of each first message in the multiple first messages is a random phase.

31. The method according to claim 30, wherein: Different second messages among the multiple second messages carry different timestamps, and phases of the different second messages are related to the phase of the first message.

32. The method according to any one of claims 19 to 31, wherein: The last second message carries a message authentication code MAC, and the MAC is generated based on the key of the second device.

33. The method according to any one of claims 19 to 32, wherein: The method further comprises: The second device receives a fourth message sent by the first device, where the fourth message carries the number of the first message used to generate the key.

34. The method according to any one of claims 19 to 33, wherein: The first device is a first terminal or a first network device; the second device is a zero-power consumption device.

35. A first device, comprising: A first communication unit, configured to send a plurality of first messages to a second device, wherein different first messages in the plurality of first messages occupy different time domain ranges, and the plurality of first messages are used by the second device to generate a key; receiving a plurality of second messages sent by the second device, where different second messages in the plurality of second messages are related to different first messages, and a last second message in the plurality of second messages carries a key of the second device; The first processing unit is used to generate a verification key for the second device based on the multiple second messages and the target model, and send a confirmation message to the second device through the first communication unit when the verification key of the second device is consistent with the key of the second device.

36. The first device according to claim 35, wherein: The first processing unit is used to obtain a plurality of parameter estimation values ​​based on the plurality of second messages and the target model, wherein different parameter estimation values ​​among the plurality of parameter estimation values ​​are estimation values ​​of relevant parameters of different first messages obtained by the second device; and determine a verification key for the second device based on the plurality of parameter estimation values.

37. The first device according to claim 36, wherein: The first processing unit is used to preprocess the relevant parameters of each second message in the multiple second messages to obtain the preprocessed relevant parameters of each second message; The preprocessed relevant parameters of each second message are input into the target model to obtain the multiple parameter estimation values ​​output by the target model.

38. The first device according to claim 37, wherein: The first processing unit is used to determine a first standard deviation and a first average value based on relevant parameters of each second message in the multiple second messages; preprocess the relevant parameters of each second message based on the first average value and the first standard deviation to obtain the preprocessed relevant parameters of each second message.

39. The first device according to claim 36, wherein: The first processing unit is used to input relevant parameters of each second message in the multiple second messages into the target model to obtain the multiple parameter estimation values ​​output by the target model. The target model is used to preprocess the relevant parameters of each second message to obtain the preprocessed relevant parameters of each second message, and obtain the multiple parameter estimation values ​​based on the preprocessed relevant parameters of each second message.

40. The first device according to any one of claims 36 to 39, wherein: The last second message carries multiple quantization offsets, and different quantization offsets in the multiple quantization offsets are related to relevant parameters of different first messages obtained by the second device; The first processing unit is configured to obtain a plurality of quantization reference estimation values ​​based on the plurality of parameter estimation values ​​and the plurality of quantization offsets; Determining a plurality of quantization estimation results based on an index value of each quantization reference estimation value in the plurality of quantization reference estimation values; Based on the multiple quantization estimation results, a verification key of the second device is obtained.

41. The first device according to any one of claims 35 to 40, wherein: The first processing unit is used to train a preset model based on training data to obtain the target model, and the training data is related to the following parameters: relevant parameters of each third message in a plurality of third messages sent by the first device obtained by the second device, and relevant parameters of each reflected message in a plurality of reflected messages sent by the second device obtained by the first device, and different reflected messages in the plurality of reflected messages are related to different third messages.

42. The first device according to any one of claims 36 to 41, wherein: The relevant parameters include reception strength.

43. The first device according to any one of claims 36 to 41, wherein: The relevant parameters include phase.

44. The first device according to claim 42, wherein: The transmission power of each first message in the multiple first messages is a random transmission power.

45. The first device according to claim 44, wherein Different second messages among the multiple second messages are obtained by the second device modulating different first messages based on a reflection coefficient.

46. ​​The first device according to claim 45, wherein Different second messages among the multiple second messages correspond to different reflection coefficients.

47. A first device according to claim 45 or 46, wherein: Different first messages among the multiple first messages carry different reflection coefficient indication information, and the different reflection coefficient indication information is used to indicate reflection coefficients corresponding to different second messages.

48. The first device according to claim 43, wherein: The phase of each first message in the multiple first messages is a random phase.

49. The first device according to claim 48, wherein Different second messages among the multiple second messages carry different timestamps, and phases of the different second messages are related to the phase of the first message.

50. The first device according to any one of claims 35 to 49, wherein: The last second message carries a message authentication code MAC, where the MAC is generated based on the key of the second device; The first processing unit is configured to generate information to be verified based on the verification key of the second device and the last second message; If the information to be verified is consistent with the MAC, determine the verification key of the second device and the secret key of the second device. The key is the same.

51. The first device according to any one of claims 35 to 50, wherein: The first communication unit is used to send a fourth message to the second device, where the fourth message carries the number of the first message used to generate the key.

52. The first device according to any one of claims 35 to 51, wherein: The first device is a first terminal or a first network device; the second device is a zero-power consumption device.

53. A second device, comprising: A second communication unit is used to receive multiple first messages sent by the first device, where different first messages in the multiple first messages occupy different time domain ranges; Sending a plurality of second messages to the first device, where different second messages in the plurality of second messages are related to different first messages, and a last second message in the plurality of second messages carries a key of the second device; a second processing unit, configured to generate a key of the second device based on the plurality of first messages; When a confirmation message sent by the first device is received through the second communication unit, it is determined that the key verification of the second device has passed.

54. The second device according to claim 53, wherein The second processing unit is used to obtain a second average value and a second standard deviation based on relevant parameters of each first message in the multiple first messages; Based on the second average value, the second standard deviation, and the relevant parameter of each first message, a plurality of processed relevant parameters are obtained; Based on the multiple processed related parameters, a plurality of quantitative reference values ​​are obtained; Based on the plurality of quantized reference values, a key for the second device is generated.

55. The second device according to claim 54, wherein The second processing unit is used to determine, based on multiple candidate quantization reference values, a candidate quantization reference value with the smallest difference from the mth processed related parameter as the mth quantization reference value, the multiple candidate quantization reference values ​​are determined based on the related parameters of each first message, the mth processed related parameter is one of the multiple processed related parameters, the mth quantization reference value is one of the multiple quantization reference values, and m is a positive integer.

56. The second device according to claim 54 or 55, wherein The second processing unit is configured to determine a plurality of quantization results based on an index value of each quantization reference value in the plurality of quantization reference values; Based on the multiple quantization results, a key of the second device is generated.

57. The second device according to any one of claims 54 to 56, wherein: The last second message carries multiple quantization offsets; the second processing unit is used to obtain the multiple quantization offsets based on the multiple quantization reference values ​​and the multiple processed related parameters.

58. The second device according to any one of claims 54 to 57, wherein: The relevant parameter is reception strength.

59. The second device according to any one of claims 54 to 57, wherein: The relevant parameter is the phase.

60. The second device according to claim 58, wherein The transmission power of each first message in the multiple first messages is a random transmission power.

61. The second device according to claim 60, wherein: Different second messages among the multiple second messages are obtained by the second device modulating different first messages based on a reflection coefficient.

62. The second device according to claim 61, wherein Different second messages among the multiple second messages correspond to different reflection coefficients.

63. The second device according to claim 61 or 62, wherein: Different first messages among the multiple first messages carry different reflection coefficient indication information, and the different reflection coefficient indication information is used to indicate reflection coefficients corresponding to different second messages.

64. The second device according to claim 59, wherein The phase of each first message in the multiple first messages is a random phase.

65. The second device according to claim 64, wherein Different second messages among the multiple second messages carry different timestamps, and phases of the different second messages are related to the phase of the first message.

66. The second device according to any one of claims 53 to 65, wherein: The last second message carries a message authentication code MAC, and the MAC is generated based on the key of the second device.

67. The second device according to any one of claims 53 to 66, wherein: The second communication unit is used to receive a fourth message sent by the first device, where the fourth message carries the number of the first message used to generate the key.

68. The second device according to any one of claims 53 to 67, wherein: The first device is a first terminal or a first network device; the second device is a zero-power consumption device.

69. A first device, comprising: A transceiver, a processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program stored in the memory, so that the first device executes the method according to any one of claims 1 to 18.

70. A second device, comprising: A transceiver, a processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program stored in the memory so that the second device executes the method as claimed in any one of claims 19 to 34.

71. A chip, comprising: A processor, configured to call and run a computer program from a memory, so that a device equipped with the chip executes a method as claimed in any one of claims 1 to 18 or claims 19 to 34.

72. A computer-readable storage medium for storing a computer program, which, when executed by a device, causes the device to perform the method according to any one of claims 1 to 18 or claims 19 to 34.

73. A computer program product comprising computer program instructions for causing a computer to perform the method of any one of claims 1 to 18 or claims 19 to 34.

74. A computer program causing a computer to perform the method of any one of claims 1 to 18 or claims 19 to 34.