Communication method and apparatus

MYPI2025001631A0Undetermined Publication Date: 2024-03-30HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
MYPI2025001631
Authority / Receiving Office
MY · MY
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-07
Filing Date
2023-08-11
Publication Date
2024-03-30

AI Technical Summary

Technical Problem

In dual-connection or multi-connection scenarios, terminal devices are prone to security key reuse issues during the process of adding or changing candidate cells, resulting in insecure communications.

Method used

By deriving the first key and determining the third key based on the second key and parameter values, it is ensured that a different key is used each time when accessing the candidate cell, and key reuse is avoided. Specific methods include updating parameter values ​​or selecting unused keys to maintain communication security when switching candidate cells.

Benefits of technology

It effectively avoids the problem of key reuse, ensures the security of the communication process between the terminal device and the auxiliary station, and prevents data from being eavesdropped and tampered with.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure PI2025001631_DRAWING_001
    Figure PI2025001631_DRAWING_001
  • Figure PI2025001631_DRAWING_002
    Figure PI2025001631_DRAWING_002
  • Figure PI2025001631_DRAWING_003
    Figure PI2025001631_DRAWING_003
Patent Text Reader

Abstract

Embodiments of this application provide a communication method and apparatus. The method includes: deriving a first key, and deriving a third key based on the first key, where the first key is determined based on a second key by using a first parameter value, the second key is a master key, the first parameter value is obtained through update based on a second parameter value, or the first parameter value is determined based on a quantity of times of accessing a first cell or a secondary node to which the first cell belongs, the third key is a user plane key and / or a control plane key, and the third key is used to perform encryption or data integrity protection on data and / or signaling with the first cell. According to the foregoing solution, key reuse can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

A communication method and device

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on September 30, 2022, with application number 202211214503.X and application name “A Method and Device for Communication”, the entire contents of which are incorporated by reference into this application.

[0002] This application also claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on April 7, 2023, with application number 202310409631.8 and application name “A Method and Apparatus for Communication”, the entire contents of which are incorporated by reference into this application.

[0003] This application also claims priority to a patent application filed with the China Acceptance Office on August 4, 2023, with application number PCT / CN2023 / 111239 and application name “A Method and Apparatus for Communication,” the entire contents of which are incorporated by reference into this application. Technical Field

[0004] The embodiments of the present application relate to the field of communications, and more specifically, to a communication method and apparatus. Background Art

[0005] In dual-connectivity (DC) or multi-radio dual connectivity (MR-DC) scenarios, the terminal device may need to add or change a conditional primary secondary cell group cell (PSCell). When the terminal device evaluates that the execution conditions of a candidate cell are met, the terminal device can perform the PSCell addition or change process.

[0006] To prevent data from being eavesdropped and / or tampered with, communications between a terminal device and a cell can be encrypted and / or integrity protected based on security keys. However, when a terminal device adds or changes subsequent candidate cells, security key reuse may occur, resulting in insecure communication between the terminal device and the candidate cells under the secondary station.

[0007] Therefore, how to avoid the reuse of security keys when a terminal device adds or changes candidate cells becomes a technical problem that needs to be solved urgently.

[0008] Summary of the Invention

[0009] The embodiments of the present application provide a communication method and apparatus that can avoid key reuse during the process of adding or changing candidate cells on a terminal device.

[0010] In a first aspect, a method is provided. The method may be executed by a terminal device or by a chip or circuit configured in the terminal device, and this application does not limit this.

[0011] The method includes: deriving a first key and deriving a third key based on the first key, wherein the first key is based on the second key and is determined using a first parameter value, the second key is a primary key, the first parameter value is updated based on the second parameter value, or the first parameter value is determined based on the number of times of access to the first cell or the secondary station to which the first cell belongs, the third key is a user plane key and / or a control plane key, and the third key is used to encrypt data and / or signaling between the first cell or the secondary station and the third key is used to protect data integrity.

[0012] As an example, the second key may be a master key between the terminal device and the MN, for example, K gNB , or K eNB . The master key is used to derive the control plane key and / or the user plane key, and the control plane key and / or the user plane key are used to encrypt or protect the data integrity of the data and / or signaling between the terminal device and the MN. For example, the control plane key is used to encrypt and / or protect the data integrity of the signaling between the terminal device and the MN. For another example, the user plane key is used to encrypt and / or protect the data integrity of the data between the terminal device and the MN.

[0013] As an example, the first key may be a secondary key, such as K SN , SK gNB or SK eNB . The first key is used to derive the control plane key and / or the user plane key, and the control plane key and / or the user plane key are used to encrypt or protect the data and / or signaling between the terminal device and the SN, that is, the third key. For example, the control plane key is used to encrypt and / or protect the data integrity of the signaling between the terminal device and the SN. For another example, the user plane key is used to encrypt and / or protect the data integrity of the data between the terminal device and the SN. For example, the third key is the integrity protection key (K RRCint or K UPint ) and / or encryption / decryption key (K RRCenc or K UPenc ).

[0014] It should be understood that deriving a key may also be referred to as deducing a key, deducing a key, determining a key, or obtaining a key, etc.

[0015] It should be noted that before deriving the first key, the terminal device may evaluate whether the execution condition of the first cell is met, where the first cell is a candidate cell added or changed to the conditional cell. If the terminal device evaluates that the execution condition of the first cell is met, the terminal device may derive the first key, and the first key may be used for the security of the first cell.

[0016] It should be understood that the terminal device does not necessarily derive the first key immediately when detecting a cell that meets the conditions. For example, the terminal device may derive the first key during or after performing an access process (eg, a random access process).

[0017] According to the above scheme, a new first parameter value can be obtained by updating the second parameter value, or a new first parameter value can be determined according to the number of times the first cell or the secondary station to which the first cell belongs is accessed, so that a new parameter value can be determined each time a candidate cell is accessed, and a new key is derived based on the new parameter value, thereby avoiding the problem of key reuse during the switching of candidate cells.

[0018] In combination with the first aspect, in some implementations of the first aspect, the second parameter value is a parameter value last used by the first cell or the secondary station to which the first cell belongs, or the second parameter value is a parameter value used for the last access.

[0019] In combination with the first aspect, in certain implementations of the first aspect, the second parameter value is a parameter value used by the third cell for the last access, and the third cell has the same second parameter as the first cell.

[0020] In combination with the first aspect, in some implementations of the first aspect, the first key is derived when switching from a cell with a different second parameter value to the first cell.

[0021] In combination with the first aspect, in some implementations of the first aspect, the second parameter value is a parameter value last used by a cell in a first cell set, where the first cell set includes the first cell.

[0022] In combination with the first aspect, in some implementations of the first aspect, the first key is derived when switching from a cell outside the first cell set to the first cell.

[0023] In combination with the first aspect, in certain implementations of the first aspect, the first parameter value is the second parameter value plus N, where N is an integer greater than or equal to 1, or N is the maximum number of candidate cells added or changed in the conditional cell.

[0024] In combination with the first aspect, in certain implementations of the first aspect, the first parameter value is determined based on a third parameter value and the number of times the first cell or the secondary station to which the first cell belongs is accessed, wherein the third parameter value is a starting parameter value associated with the first cell or the secondary station to which the first cell belongs; or the first parameter value is determined based on the third parameter value and the number of times a cell of a first cell set is accessed, and the third parameter value is a starting parameter value associated with the first cell set.

[0025] In combination with the first aspect, in certain implementations of the first aspect, the first parameter value is the Pth value in the first set, where P is related to the number of times the first cell or the secondary station to which the first cell belongs is accessed, and the first set includes multiple parameter values ​​associated with the first cell or the secondary station to which the first cell belongs.

[0026] In conjunction with the first aspect, in certain implementations of the first aspect, the method further includes:

[0027] The first message is sent to the primary station, where the first message indicates the first cell that meets the execution condition or the secondary station to which the first cell belongs, and the first message includes the first parameter value.

[0028] In a second aspect, a communication method is provided. The method can be executed by a terminal device or by a chip or circuit configured in the terminal device, and this application does not limit this.

[0029] The method includes: deriving a first key, wherein the first key is determined based on a second key and using a first parameter value, the second key is a master key, the first parameter value belongs to a third set, the third set includes multiple parameter values ​​associated with a first cell set, and the first cell set includes the first cell; deriving a third key based on the first key, the third key is a user plane key and / or a control plane key, and the third key is used to encrypt data and / or signaling between the first cell or perform data integrity protection.

[0030] In combination with the second aspect, in certain implementations of the second aspect, the first parameter value is randomly selected from a plurality of parameter values ​​included in the third set.

[0031] In combination with the second aspect, in certain implementations of the second aspect, the first parameter value is the Pth value in the third set, where P is related to the number of times the first cell set is accessed.

[0032] In combination with the second aspect, in some implementations of the second aspect, the first parameter value is deleted from the third set.

[0033] In combination with the second aspect, in certain implementations of the second aspect, the first key is derived when switching from a cell outside the first cell set to the first cell.

[0034] In a third aspect, a communication method is provided. The method can be executed by a network device or by a chip or circuit configured in the network device, and this application does not limit this.

[0035] The method includes: deriving a first key, and sending the first key to a first cell or a secondary station to which the first cell belongs, wherein the first key is used for the security of the first cell, the first cell is a candidate cell for adding or changing CPAC for a conditional cell, the first key is based on a second key and is determined using a first parameter value, the second key is a master key, the first parameter value is received from a terminal device, or the first parameter value is updated based on the second parameter value, or the first parameter value is determined based on the number of times the terminal device accesses the first cell or the secondary station to which the first cell belongs.

[0036] In combination with the third aspect, in certain implementations of the third aspect, a second set is sent to the first cell or the secondary station to which the first cell belongs. The second set includes multiple keys associated with the first cell or the secondary station to which the first cell belongs, and the multiple keys include the first key.

[0037] In combination with the third aspect, in certain implementations of the third aspect, the method further includes: receiving a first message from the terminal device, the first message including the first parameter value, the first message indicating the first cell that meets the execution condition or the secondary station to which the first cell belongs.

[0038] In combination with the third aspect, in certain implementations of the third aspect, the second parameter value is the parameter value last used by the first cell or the secondary station to which the first cell belongs, or the second parameter value is the parameter value last used by the terminal device for access.

[0039] In combination with the third aspect, in certain implementations of the third aspect, the second parameter value is a parameter value used by the third cell for the last access, and the third cell has the same second parameter as the first cell.

[0040] In combination with the third aspect, in certain implementations of the third aspect, the first key is derived when switching from a cell with a different second parameter value to the first cell.

[0041] In combination with the third aspect, in certain implementations of the third aspect, the second parameter value is a parameter value last used by a cell in a first cell set, where the first cell set includes the first cell.

[0042] In combination with the third aspect, in certain implementations of the third aspect, the first key is derived when switching from a cell outside the first cell set to the first cell.

[0043] In combination with the third aspect, in certain implementations of the third aspect, the first parameter value is the second parameter value plus N, where N is an integer greater than or equal to 1, or N is the maximum number of candidate cells added or changed for the conditional cell.

[0044] In combination with the third aspect, in certain implementations of the third aspect, the first parameter value is determined based on the third parameter value and the number of times the terminal device accesses the first cell or the secondary station to which the first cell belongs, wherein the third parameter value is the starting parameter value associated with the first cell or the secondary station to which the first cell belongs; or the first parameter value is determined based on the third parameter value and the number of times the cell of the first cell set is accessed, and the third parameter value is the starting parameter value associated with the first cell set.

[0045] In combination with the third aspect, in certain implementations of the third aspect, the first parameter value is the Pth value in the first set, where P is related to the number of times the terminal device accesses the first cell or the secondary station to which the first cell belongs, and the first set includes multiple parameter values ​​associated with the first cell or the secondary station to which the first cell belongs.

[0046] It should be understood that the beneficial effects of the third aspect and its various implementations can refer to the first aspect and its various implementations.

[0047] In a fourth aspect, a communication method is provided. The method can be executed by a network device or by a chip or circuit configured in the network device, and this application does not limit it.

[0048] The method includes: receiving a second set, and determining the first key from the second set based on a first identifier or the number of times a terminal device accesses the first cell or the secondary station to which the first cell belongs, wherein the second set includes multiple keys associated with the first cell or the secondary station to which the first cell belongs, the multiple keys include the first key, and the first identifier is used to indicate the first key in the second set.

[0049] In the above technical solution, by providing corresponding K SN The K corresponding to each candidate cell or the secondary station to which the candidate cell belongs is set, so that the candidate cell or the secondary station to which the candidate cell belongs does not have to communicate securely with the terminal device only after receiving the reconfiguration completion message of the MN. SN The set includes K that may be added or changed in the starting cell, as well as the K used in subsequent cell changes. SN .

[0050] In combination with the fourth aspect, in some implementations of the fourth aspect, the method further includes: receiving a second message, where the second message includes the first identifier.

[0051] In the above technical solution, the first key in the second set is determined to be used by receiving the first identifier of the terminal device, so that the keys used by the terminal device and the auxiliary station are aligned, ensuring the security synchronization between the terminal device and the auxiliary station, and avoiding the problem of security parameter misalignment or security parameter rollback caused by the terminal device's failed access attempt.

[0052] In a fifth aspect, a communication method is provided. The method can be executed by a terminal device or by a chip or circuit configured in the terminal device, and this application does not limit it.

[0053] The method includes: deriving a fourth key, and deriving a sixth key based on the fourth key, wherein the fourth key is determined based on a fifth key, the fifth key is the key of the last cell accessed, or the fifth key is the key used for the last access to the second cell or the secondary station to which the second cell belongs, or the fifth key is the key last used for the cell in the second cell set, and the first cell set includes the second cell, or the fifth key is the key used for the last access to the fourth cell, and the fourth cell has the same key or the same count value as the second cell, and the sixth key is a user plane key and / or a control plane key, and the sixth key is used to encrypt and / or protect data integrity of data and / or signaling between the second cell.

[0054] It should be noted that before deriving the fourth key, the terminal device may evaluate whether the execution condition of the second cell is met, where the second cell is a candidate cell for adding or changing the conditional cell. When the terminal device evaluates that the execution condition of the second cell is met, the terminal device may derive the fourth key, and the fourth key may be used for the security of the second cell.

[0055] As an example, the fourth key and the fifth key are secondary keys, such as K SN , SK gNB or SK eNB .

[0056] As an example, the sixth key is the integrity protection key (K RRCint or K UPint ) and / or encryption / decryption key (K RRCenc or K UPenc ).

[0057] In the above technical solution, each time the terminal device selects a candidate cell, the fifth key used to derive the fourth key is different, or a new K is derived.SN The input key K used SN Therefore, the fifth key used for each access to the candidate cell is different, and the sixth key derived from the fifth key is also different, thereby avoiding the problem of key reuse.

[0058] In combination with the fifth aspect, in certain implementations of the fifth aspect, the fourth key is derived when switching from a cell outside the second cell set to the second cell, or when switching from a cell with a different count value to the second cell.

[0059] In combination with the fifth aspect, in certain implementations of the fifth aspect, the fourth key is derived based on the fifth key and using a fourth parameter value.

[0060] In combination with the fifth aspect, in certain implementations of the fifth aspect, the fourth parameter value is a parameter value associated with the second cell or the secondary station to which the second cell belongs, or the fourth parameter value is a parameter value associated with the second cell set, or the fourth parameter value is updated based on the fifth parameter value, or the fourth parameter value is determined based on the number of accesses to the second cell or the secondary station to which the second cell belongs.

[0061] In combination with the fifth aspect, in certain implementations of the fifth aspect, the fifth parameter value is the parameter value last used by the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is the parameter value last used by the last access, or the fifth parameter value is the parameter value last used by the cell in the second cell set.

[0062] In a sixth aspect, a communication method is provided. The method can be executed by a network device or by a chip or circuit configured in the network device, and this application does not limit it.

[0063] The method includes: deriving a fourth key, and sending the fourth key to the second cell or a secondary station to which the second cell belongs, wherein the fourth key is used for the security of the second cell, the fourth key is determined based on a fifth key, the fifth key is a key for a previous cell accessed, or the fifth key is a key used for the last access to the second cell or the secondary station to which the second cell belongs.

[0064] In combination with the sixth aspect, in certain implementations of the sixth aspect, the fourth key is derived based on the fifth key and using a fourth parameter value, the fourth parameter value is a parameter value associated with the second cell or the secondary station to which the second cell belongs, or the fourth parameter value is a parameter value associated with the second cell set.

[0065] In combination with the sixth aspect, in certain implementations of the sixth aspect, the fifth key is determined based on the sixth key and using a fifth parameter value, the sixth key is the master key, the fifth parameter value is a parameter value associated with the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is updated based on the sixth parameter value, or the fifth parameter value is determined based on the number of times the terminal device accesses the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is the parameter value last used by the cell in the second cell set.

[0066] In combination with the sixth aspect, in certain implementations of the sixth aspect, the sixth parameter value is the parameter value last used by the second cell or the secondary station to which the second cell belongs, or the sixth parameter value is the parameter value last used by the terminal device for access.

[0067] It should be understood that the beneficial effects of the above-mentioned sixth aspect and its various implementations can be referred to the fifth aspect and its various implementations.

[0068] In the seventh aspect, a communication method is provided. The method can be executed by a network device or by a chip or circuit configured in the network device, and this application does not limit it.

[0069] The method includes: deriving a fourth key, and deriving a sixth key based on the fourth key, wherein the fourth key is used for the security of the second cell, the fourth key is determined based on the fifth key, the fifth key is the key used for the last access to the second cell or access to the secondary station to which the second cell belongs, or the fifth key is the key last used for a cell in the second cell set, the first cell set includes the second cell, or the fifth key is the key used for the last access to the fourth cell, the fourth cell has the same key or the same count value as the second cell, the sixth key is a user plane key and / or a control plane key, and the sixth key is used to encrypt data and / or signaling between the terminal device or protect data integrity.

[0070] In combination with the seventh aspect, in certain implementations of the seventh aspect, the fourth key is derived based on the fifth key and using a fourth parameter value, the fourth parameter value is a parameter value associated with the second cell or the secondary station to which the second cell belongs, or the fourth parameter value is a parameter value associated with the second cell set.

[0071] In combination with the seventh aspect, in certain implementations of the seventh aspect, the fifth key is determined based on the sixth key and using a fifth parameter value, the sixth key is the master key, the fifth parameter value is a parameter value associated with the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is updated based on the sixth parameter value, or the fifth parameter value is determined based on the number of times the terminal device accesses the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is the parameter value last used by the cell in the second cell set.

[0072] In combination with the seventh aspect, in certain implementations of the seventh aspect, the sixth parameter value is the parameter value last used by the second cell or the secondary station to which the second cell belongs, or the sixth parameter value is the parameter value last used by the terminal device for access.

[0073] It should be understood that the beneficial effects of the above-mentioned seventh aspect and its various implementations can be referred to the fifth aspect and its various implementations.

[0074] In an eighth aspect, a communication device is provided. The device may be a terminal device or a chip or circuit configured in the terminal device, and this application does not limit this.

[0075] The device includes: a processing unit, configured to derive a first key and derive a third key based on the first key, wherein the first key is based on the second key and is determined using a first parameter value, the second key is a primary key, the first parameter value is updated based on the second parameter value, or the first parameter value is determined based on the number of times the first cell or the secondary station to which the first cell belongs is accessed, the third key is a user plane key and / or a control plane key, and the third key is used to encrypt data and / or signaling between the first cell or the secondary station and the third key is used to perform data integrity protection on the data and / or signaling between the first cell and the secondary station.

[0076] In combination with the eighth aspect, in certain implementations of the eighth aspect, the second parameter value is a parameter value last used by the first cell or the secondary station to which the first cell belongs, or the second parameter value is a parameter value used for the last access.

[0077] In combination with the eighth aspect, in certain implementations of the eighth aspect, the second parameter value is a parameter value used by the third cell for the last access, and the third cell has the same second parameter as the first cell.

[0078] In combination with the eighth aspect, in certain implementations of the eighth aspect, the first key is derived when switching from a cell with a different second parameter value to the first cell.

[0079] In combination with the eighth aspect, in certain implementations of the eighth aspect, the second parameter value is a parameter value last used by a cell in a first cell set, where the first cell set includes the first cell.

[0080] In combination with the eighth aspect, in certain implementations of the eighth aspect, the first key is derived when switching from a cell outside the first cell set to the first cell.

[0081] In combination with the eighth aspect, in certain implementations of the eighth aspect, the first parameter value is the second parameter value plus N, where N is an integer greater than or equal to 1, or N is the maximum number of candidate cells added or changed in the conditional cell.

[0082] In combination with the eighth aspect, in certain implementations of the eighth aspect, the first parameter value is determined based on the third parameter value and the number of times the first cell or the secondary station to which the first cell belongs is accessed, wherein the third parameter value is the starting parameter value associated with the first cell or the secondary station to which the first cell belongs; or the first parameter value is determined based on the third parameter value and the number of times a cell of the first cell set is accessed, and the third parameter value is the starting parameter value associated with the first cell set.

[0083] In combination with the eighth aspect, in certain implementations of the eighth aspect, the first parameter value is the Pth value in the first set, where P is related to the number of times the first cell or the secondary station to which the first cell belongs is accessed, and the first set includes multiple parameter values ​​associated with the first cell or the secondary station to which the first cell belongs.

[0084] In combination with the eighth aspect, in certain implementations of the eighth aspect, the device includes: a transceiver unit, used to send the first message to the primary station, the first message indicating the first cell that meets the execution conditions or the secondary station to which the first cell belongs, and the first message including the first parameter value.

[0085] It should be understood that the beneficial effects of the above-mentioned eighth aspect and its various implementations can refer to the first aspect and its various implementations.

[0086] In a ninth aspect, a communication device is provided. The device may be a terminal device or a chip or circuit configured in the terminal device, and this application does not limit this.

[0087] The device includes: a processing unit, configured to derive a fourth key, and derive a sixth key based on the fourth key, wherein the fourth key is determined based on a fifth key, the fifth key is the key of the last cell accessed, or the fifth key is the key used for the last access to the second cell or the secondary station to which the second cell belongs, or the fifth key is the key last used for the cell in the second cell set, and the first cell set includes the second cell, or the fifth key is the key used for the last access to the fourth cell, and the fourth cell has the same key or the same count value as the second cell, and the sixth key is a user plane key and / or a control plane key, and the sixth key is used to encrypt data and / or signaling between the second cell or to protect data integrity.

[0088] In combination with the ninth aspect, in certain implementations of the ninth aspect, the processing unit is specifically used to derive the fourth key when switching from a cell outside the second cell set to the second cell, or when switching from a cell with a different count value to the second cell.

[0089] In combination with the ninth aspect, in certain implementations of the ninth aspect, the processing unit is specifically used to derive the fourth key based on the fifth key and using a fourth parameter value, where the fourth parameter value is a parameter value associated with the second cell or the secondary station to which the second cell is connected.

[0090] In combination with the ninth aspect, in certain implementations of the ninth aspect, the fourth parameter value is a parameter value associated with the second cell or the secondary station to which the second cell belongs, or the fourth parameter value is a parameter value associated with the second cell set, or the fourth parameter value is updated based on the fifth parameter value, or the fourth parameter value is determined based on the number of accesses to the second cell or the secondary station to which the second cell belongs.

[0091] In combination with the ninth aspect, in certain implementations of the ninth aspect, the fifth parameter value is the parameter value last used by the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is the parameter value last used by the last access, or the fifth parameter value is the parameter value last used by the cell in the second cell set.

[0092] It should be understood that the beneficial effects of the above-mentioned ninth aspect and its various implementations can be referred to the fifth aspect and its various implementations.

[0093] In the eighth and ninth aspects, when the communication device is a terminal device, the processing unit may be a processor, and the transceiver unit may be a transceiver. When the communication device is a chip or circuit configured in the terminal device, the processing unit may be a processor, and the transceiver unit may be an input / output interface, pin, or circuit, etc.

[0094] In the tenth aspect, a communication device is provided. The device may be a network device or a chip or circuit configured in the network device, and this application does not limit this.

[0095] The apparatus includes: a processing unit and a transceiver unit, wherein the processing unit is configured to derive a first key, wherein the first key is used for the security of a first cell, wherein the first cell is a candidate cell for adding or changing CPAC as a conditional cell, the first key is determined based on a second key and using a first parameter value, the second key is a master key, the first parameter value is received from a terminal device, or the first parameter value is updated based on the second parameter value, or the first parameter value is determined based on the number of times the terminal device accesses the first cell or a secondary station to which the first cell belongs. The transceiver unit is configured to send the first key to the first cell or the secondary station to which the first cell belongs.

[0096] In combination with the tenth aspect, in certain implementations of the tenth aspect, the transceiver unit is specifically used to send a second set to the first cell or the secondary station to which the first cell belongs, the second set including multiple keys associated with the first cell or the secondary station to which the first cell belongs, and the multiple keys including the first key.

[0097] In combination with the tenth aspect, in certain implementations of the tenth aspect, the transceiver unit is further used to receive a first message from the terminal device, the first message including the first parameter value, and the first message indicating the first cell that meets the execution conditions or the secondary station to which the first cell belongs.

[0098] In combination with the tenth aspect, in certain implementations of the tenth aspect, the second parameter value is the parameter value last used by the first cell or the secondary station to which the first cell belongs, or the second parameter value is the parameter value last used by the terminal device for access.

[0099] In combination with the tenth aspect, in certain implementations of the tenth aspect, the second parameter value is a parameter value used for the last access of the third cell, and the third cell has the same second parameter as the first cell.

[0100] In combination with the tenth aspect, in certain implementations of the tenth aspect, the processing unit is specifically configured to derive the first key when switching from a cell with a different second parameter value to the first cell.

[0101] In combination with the tenth aspect, in certain implementations of the tenth aspect, the second parameter value is a parameter value last used by a cell in a first cell set, wherein the first cell set includes the first cell.

[0102] In combination with the tenth aspect, in certain implementations of the tenth aspect, the processing unit is specifically configured to derive the first key when switching from a cell outside the first cell set to the first cell.

[0103] In combination with the tenth aspect, in certain implementations of the tenth aspect, the first parameter value is the second parameter value plus N, where N is an integer greater than or equal to 1, or N is the maximum number of candidate cells added or changed in the conditional cell.

[0104] In combination with the tenth aspect, in certain implementations of the tenth aspect, the first parameter value is determined based on the third parameter value and the number of times the terminal device accesses the first cell or the secondary station to which the first cell belongs, wherein the third parameter value is the starting parameter value associated with the first cell or the secondary station to which the first cell belongs; or the first parameter value is determined based on the third parameter value and the number of times the cell of the first cell set is accessed, and the third parameter value is the starting parameter value associated with the first cell set.

[0105] In combination with the tenth aspect, in certain implementations of the tenth aspect, the first parameter value is the Pth value in the first set, where P is related to the number of times the terminal device accesses the first cell or the secondary station to which the first cell belongs, and the first set includes multiple parameter values ​​associated with the first cell or the secondary station to which the first cell belongs.

[0106] It should be understood that the beneficial effects of the above-mentioned tenth aspect and its various implementations can be referred to the third aspect and its various implementations.

[0107] In the eleventh aspect, a communication device is provided. The device may be a network device or a chip or circuit configured in the network device, and this application does not limit this.

[0108] The device includes: a processing unit and a transceiver unit, wherein the processing unit is used to derive a fourth key, wherein the fourth key is used for the security of the second cell, the fourth key is determined based on a fifth key, the fifth key is the key used for accessing the previous cell, or the fifth key is the key used for the last access to the second cell or access to the secondary station to which the second cell belongs; the transceiver unit is used to send the fourth key to the second cell or the secondary station to which the second cell belongs.

[0109] In combination with the eleventh aspect, in certain implementations of the eleventh aspect, the processing unit is specifically used to derive the fourth key based on the fifth key and using a fourth parameter value, the fourth parameter value being a parameter value associated with the second cell or the secondary station to which the second cell belongs, or the fourth parameter value being a parameter value associated with the second cell set.

[0110] In combination with the eleventh aspect, in certain implementations of the eleventh aspect, the fifth key is determined based on the sixth key and using a fifth parameter value, the sixth key is the master key, the fifth parameter value is a parameter value associated with the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is updated based on the sixth parameter value, or the fifth parameter value is determined based on the number of times the terminal device accesses the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is the parameter value last used by the cell in the second cell set.

[0111] In combination with the eleventh aspect, in certain implementations of the eleventh aspect, the sixth parameter value is the parameter value last used by the second cell or the secondary station to which the second cell belongs, or the sixth parameter value is the parameter value last used by the terminal device for access.

[0112] It should be understood that the beneficial effects of the above-mentioned eleventh aspect and its various implementations can be referred to the sixth aspect and its various implementations.

[0113] In the twelfth aspect, a communication device is provided. The device may be a network device or a chip or circuit configured in the network device, and this application does not limit this.

[0114] The device includes: a processing unit and a transceiver unit, wherein the transceiver unit is used to receive a second set, the second set including multiple keys associated with a first cell or a secondary station to which the first cell belongs, the multiple keys including a first key; the processing unit is used to determine the first key from the second set based on a first identifier or the number of times a terminal device accesses the first cell or the secondary station to which the first cell belongs, and the first identifier is used to indicate the position of the first key in the second set.

[0115] In combination with the twelfth aspect, in some implementations of the twelfth aspect, the transceiver unit is further used to receive a second message, where the second message includes the first identifier.

[0116] It should be understood that the beneficial effects of the above-mentioned twelfth aspect and its various implementations can be referred to the fourth aspect and its various implementations.

[0117] In the thirteenth aspect, a communication device is provided. The device may be a network device or a chip or circuit configured in the network device, and this application does not limit this.

[0118] The device includes: a processing unit, used to derive a fourth key, and derive a sixth key based on the fourth key, wherein the fourth key is used for the security of the second cell, the fourth key is determined based on the fifth key, the fifth key is the key used for the last access to the second cell or access to the secondary station to which the second cell belongs, or the fifth key is the key last used for a cell in the second cell set, the first cell set includes the second cell, or the fifth key is the key used for the last access to the fourth cell, the fourth cell has the same key or the same count value as the second cell, the sixth key is a user plane key and / or a control plane key, and the sixth key is used to encrypt data and / or signaling between the terminal device or protect data integrity.

[0119] In combination with the thirteenth aspect, in certain implementations of the thirteenth aspect, the processing unit is specifically used to derive the fourth key when switching from a cell outside the second cell set to the second cell, or when switching from a cell with a different count value to the second cell.

[0120] In combination with the thirteenth aspect, in certain implementations of the thirteenth aspect, the processing unit is further used to derive the fourth key based on the fifth key and using a fourth parameter value.

[0121] In combination with the thirteenth aspect, in certain implementations of the thirteenth aspect, the fifth key is determined based on the sixth key and using a fifth parameter value, the sixth key is the master key, the fifth parameter value is a parameter value associated with the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is updated based on the sixth parameter value, or the fifth parameter value is determined based on the number of times the terminal device accesses the second cell or the secondary station to which the second cell belongs.

[0122] In combination with the thirteenth aspect, in certain implementations of the thirteenth aspect, the sixth parameter value is the parameter value last used by the second cell or the secondary station to which the second cell belongs, or the sixth parameter value is the parameter value last used by the terminal device for access.

[0123] It should be understood that the beneficial effects of the above-mentioned thirteenth aspect and its various implementations can be referred to the fifth aspect and its various implementations.

[0124] In aspects 10 to 13, when the communication device is a network device, the processing unit may be a processor, and the transceiver unit may be a transceiver. When the communication device is a chip or circuit configured in the network device, the processing unit may be a processor, and the transceiver unit may be an input / output interface, pin, or circuit.

[0125] In a fourteenth aspect, a communication device is provided, comprising a processor and a storage medium, the storage medium storing instructions. When the instructions are executed by the processor, the method according to the first aspect or any possible implementation of the first aspect is implemented, or the method according to the fifth aspect or any possible implementation of the fifth aspect is implemented. The communication device may be a terminal device, or a chip or circuit configured in the terminal device.

[0126] Optionally, the communication device may further include a communication interface, the communication interface being configured to receive data and / or information and transmit the received data and / or information to the processor. Optionally, the communication interface is further configured to output the data and / or information processed by the processor.

[0127] In a fifteenth aspect, a communication device is provided, comprising a processor and a storage medium, the storage medium storing instructions, which, when executed by the processor, implement the method in the third aspect or any possible implementation of the third aspect, or the method in the fourth aspect or any possible implementation of the fourth aspect, or the method in the sixth aspect or any possible implementation of the sixth aspect, or the method in the seventh aspect or any possible implementation of the seventh aspect. The communication device may be a network device, or a chip or circuit configured in the network device.

[0128] Optionally, the communication device may further include a communication interface, the communication interface being configured to receive data and / or information and transmit the received data and / or information to the processor. Optionally, the communication interface is further configured to output the data and / or information processed by the processor.

[0129] In the sixteenth aspect, a computer-readable storage medium is provided, which includes instructions. When the instructions are executed by a processor, the method in the first aspect or any possible implementation of the first aspect is implemented, or the method in the fifth aspect or any possible implementation of the fifth aspect is implemented.

[0130] In the seventeenth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes instructions, which, when executed by a processor, enable the method in the third aspect or any possible implementation of the third aspect to be implemented, or enable the method in the fourth aspect or any possible implementation of the fourth aspect to be implemented, or enable the method in the sixth aspect or any possible implementation of the sixth aspect to be implemented, or enable the method in the seventh aspect or any possible implementation of the seventh aspect to be implemented.

[0131] In aspect 18, a computer program product is provided, comprising computer program code or instructions, which, when executed, enables the method in aspect 1 or any possible implementation of aspect 1 to be implemented, or enables the method in aspect 5 or any possible implementation of aspect 5 to be implemented.

[0132] In the nineteenth aspect, a computer program product is provided, comprising computer program code or instructions, which, when executed, enables the method in the third aspect or any possible implementation of the third aspect to be implemented, or enables the method in the fourth aspect or any possible implementation of the fourth aspect to be implemented, or enables the method in the sixth aspect or any possible implementation of the sixth aspect to be implemented, or enables the method in the seventh aspect or any possible implementation of the seventh aspect to be implemented.

[0133] In the twentieth aspect, a communication method is provided, including a method as in the first aspect or any possible implementation of the first aspect, a method as in the third aspect or any possible implementation of the third aspect, and a method as in the fourth aspect or any possible implementation of the fourth aspect.

[0134] In aspect 21, a communication method is provided, including a method as in aspect 4 or any possible implementation of aspect 4, a method as in aspect 5 or any possible implementation of aspect 5, and a method as in aspect 6 or any possible implementation of aspect 6.

[0135] In the twenty-second aspect, a communication system is provided, comprising the communication device in the eighth aspect or any possible implementation of the eighth aspect, the communication device in the tenth aspect or any possible implementation of the tenth aspect, and the communication device in the twelfth aspect or any possible implementation of the twelfth aspect.

[0136] In the twenty-third aspect, a communication system is provided, comprising the communication device in the ninth aspect or any possible implementation of the ninth aspect, the communication device in the eleventh aspect or any possible implementation of the eleventh aspect, and the communication device in the thirteenth aspect or any possible implementation of the thirteenth aspect.

[0137] In the twenty-fourth aspect, a communication system is provided, comprising the communication device in the fourteenth aspect or any possible implementation of the fourteenth aspect and the communication device in the fifteenth aspect or any possible implementation of the fifteenth aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0138] FIG1 is a schematic diagram of a communication system applicable to an embodiment of the present application.

[0139] FIG2 is a schematic diagram of a dual connection scenario applicable to an embodiment of the present application.

[0140] FIG3 is a schematic diagram of a key reuse method in the prior art.

[0141] FIG4 is a schematic diagram of another key reuse method in the prior art.

[0142] FIG5 is a schematic flowchart of a communication method provided in an embodiment of the present application.

[0143] FIG6 is a schematic flowchart of another communication method provided in an embodiment of the present application.

[0144] FIG7 is a schematic flowchart of another communication method provided in an embodiment of the present application.

[0145] FIG8 is a schematic flowchart of another communication method provided in an embodiment of the present application.

[0146] FIG9 is a schematic flowchart of another communication method provided in an embodiment of the present application.

[0147] FIG10 is a schematic flow chart of another communication method provided in an embodiment of the present application.

[0148] FIG11 is a schematic flowchart of another communication method provided in an embodiment of the present application.

[0149] FIG12 is a schematic block diagram of a communication device provided in an embodiment of the present application.

[0150] FIG13 is another schematic structural diagram of the communication device provided in an embodiment of the present application.

[0151] FIG14 is another schematic structural diagram of the communication device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0152] The technical solution in this application will be described below with reference to the accompanying drawings.

[0153] The technical solutions of the embodiments of the present application can be applied to various communication systems, such as: Global System of Mobile communication (GSM) system, Code Division Multiple Access (CDMA) system, Wideband Code Division Multiple Access (WCDMA) system, General Packet Radio Service (GPRS), Long Term Evolution (LTE) system, LTE frequency division duplex (FDD) system, LTE time division duplex (TDD), Universal Mobile Telecommunications System (UMTS), Worldwide Interoperability for Microwave Access (WiMAX) communication system, Fifth Generation (5G) mobile communication system or New Radio (NR). Among them, the 5G mobile communication system can be a non-standalone (NSA) or a standalone (SA) network.

[0154] The technical solution provided in this application can also be applied to machine type communication (MTC), long term evolution-machine (LTE-M), device-to-device (D2D) network, machine-to-machine (M2M) network, Internet of Things (IoT) network or other networks. Among them, the IoT network can include, for example, the Internet of Vehicles. Among them, the communication mode in the Internet of Vehicles system is collectively referred to as vehicle to other devices (vehicle to X, V2X, X can represent anything), for example, the V2X can include: vehicle to vehicle (V2V) communication, vehicle to infrastructure (V2I) communication, vehicle to pedestrian (V2P) communication or vehicle to network (V2N) communication, etc.

[0155] The technical solution provided in this application can also be applied to future communication systems, such as the sixth generation (6G) mobile communication system, etc. This application does not limit this.

[0156] In an embodiment of the present application, the terminal device may also be referred to as user equipment (UE), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user device.

[0157] A terminal device may be a device that provides voice / data connectivity to a user, such as a handheld device or vehicle-mounted device with wireless connection capabilities. Currently, some examples of terminals include: mobile phones, tablet computers, computers with wireless transceiver capabilities (such as laptops, PDAs, etc.), mobile internet devices (MIDs), virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes (such as home appliances such as televisions, smart boxes, and game consoles), cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), and so on. assistant, PDA), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to a wireless modem, vehicle-mounted devices, wearable devices, terminal devices in 5G networks, or terminal devices in future evolved public land mobile networks (PLMN), etc.

[0158] Wearable devices, also known as wearable smart devices, are a general term for wearable devices that use wearable technology to intelligently design and develop wearable devices for daily wear, such as glasses, gloves, watches, clothing, and shoes. Wearable devices are portable devices that are worn directly on the body or integrated into the user's clothing or accessories. Wearable devices are not just hardware devices, but also achieve powerful functions through software support, data interaction, and cloud interaction. In a broad sense, wearable smart devices include those that are fully functional, large in size, and can achieve full or partial functions without relying on smartphones, such as smart watches or smart glasses, as well as those that only focus on a certain type of application function and need to be used in conjunction with other devices such as smartphones, such as various smart bracelets and smart jewelry for vital sign monitoring.

[0159] Furthermore, terminal devices can also be end devices in the Internet of Things (IoT) system. IoT is a crucial component of future information technology development. Its primary technical feature is connecting objects to the Internet through communications technology, thereby enabling intelligent networks that interconnect humans and machines, and objects and things. IoT technology, for example, utilizes narrowband (NB) technology to achieve massive connectivity, deep coverage, and power-saving terminals.

[0160] In an embodiment of the present application, the terminal device can also be a vehicle or a whole vehicle, which can achieve communication through the Internet of Vehicles, or it can be a component located in the vehicle (for example, placed in the vehicle or installed in the vehicle), that is, a vehicle-mounted terminal device, a vehicle-mounted module or an on-board unit (OBU).

[0161] In addition, terminal devices can also include sensors such as smart printers, train detectors, and gas stations. Their main functions include collecting data (part of the terminal devices), receiving control information and downlink data from network devices, and sending electromagnetic waves to transmit uplink data to network devices.

[0162] In the embodiment of the present application, the network device can be any device with wireless transceiver function. The device includes but is not limited to: an evolved Node B (eNB), a radio network controller (RNC), a Node B (NB), a base station controller (BSC), a base transceiver station (BTS), a home base station (e.g., a home evolved NodeB, or a home Node B, HNB), a baseband unit (BBU), an access point (AP) in a wireless fidelity (WiFi) system, a wireless relay node, a wireless backhaul node, a transmission point (TP) or a transmission and reception point (TRP), etc. It can also be a gNB in ​​a 5G, such as NR, system, or a transmission point (TRP or TP), one or a group of antenna panels (including multiple antenna panels) of a base station in a 5G system, or a network node constituting a gNB or a transmission point, such as a baseband unit (BBU) or a distributed unit (DU), or a base station in a next-generation communication 6G system, etc.

[0163] In some deployments, a gNB may include a centralized unit (CU) and a DU. The gNB may also include an active antenna unit (AAU). The CU implements some gNB functions, while the DU implements some gNB functions. For example, the CU is responsible for processing non-real-time protocols and services, implementing the functions of the radio resource control (RRC) and packet data convergence protocol (PDCP) layers. The DU is responsible for processing physical layer protocols and real-time services, implementing the functions of the radio link control (RLC), medium access control (MAC), and physical (PHY) layers. The AAU implements some physical layer processing functions, RF processing, and active antenna-related functions. Because RRC layer information ultimately becomes PHY layer information, or is converted from PHY layer information, in this architecture, higher-layer signaling, such as RRC layer signaling, can also be considered to be sent by the DU, or by both the DU and the CU. It is understood that a network device can be a device that includes one or more of a CU node, a DU node, or an AAU node. In addition, the CU may be classified as a network device in an access network (radio access network, RAN), or may be classified as a network device in a core network (core network, CN), which is not limited in this application.

[0164] Network equipment provides services for cells, and terminal devices communicate with cells through transmission resources allocated by the network equipment (for example, frequency domain resources, or spectrum resources). The cell can belong to a macro base station (for example, a macro eNB or macro gNB) or a base station corresponding to a small cell. Small cells here can include: metro cells, micro cells, pico cells, femto cells, etc. These small cells have the characteristics of small coverage and low transmission power, and are suitable for providing high-speed data transmission services.

[0165] Figure 1 is a schematic diagram of a communication system 100 applicable to an embodiment of the present application. As shown in Figure 1 , the communication system 100 may include at least one terminal device, such as the terminal device 110 shown in Figure 1 . The communication system 100 may also include at least two network devices, such as the network device 120 and the network device 130 shown in Figure 1 . Terminal device 110 may communicate with both network device 120 and network device 130 simultaneously. For example, communication between terminal device 110 and network device 120, and between terminal device 110 and network device 130, may occur via a wireless link. Each communication device, such as terminal device 110, network device 120, or network device 130, may be configured with multiple antennas. For each communication device in the communication system, the multiple antennas configured may include at least one transmit antenna for transmitting signals and at least one receive antenna for receiving signals. Therefore, communication between the communication devices in the communication system, between terminal device 110 and network device 120, and between terminal device 110 and network device 130, may occur using multi-antenna technology.

[0166] It should be understood that FIG1 is only a simplified schematic diagram for ease of understanding, and the communication system may further include other network devices or other terminal devices, which are not shown in FIG1 .

[0167] It should also be understood that the simultaneous communication between terminal device 110 and network device 120 and network device 130 may also be referred to as dual-connectivity (DC) or multi-radio dual connectivity (MR-DC) of the terminal device. One network device communicating with terminal device 110 may be referred to as a master node (MN), and the other network device communicating with terminal device 110 may be referred to as a secondary node (SN). As an example, assume that network device 120 is an MN and network device 130 is an SN.

[0168] The MN and SN can be the same type of network equipment, or can be different types of network equipment, which is not specifically limited in this embodiment of the present application. For a specific description of the network equipment, please refer to the above description, which will not be described in detail here.

[0169] Figure 2 is a schematic diagram of a dual-connection scenario applicable to an embodiment of the present application. As shown in Figure 2, when dual connectivity is combined with carrier aggregation (CA), each network device may include a cell group (CG). Among them, the cell group under the MN is a master cell group (MCG), and the cell group under the SN is a secondary cell group (SCG). The master cell group may include a primary cell (PCell) and at least one secondary cell (SCell), and the secondary cell group may include a primary secondary cell (PSCell) and at least one secondary cell (SCell).

[0170] It should be understood that when dual connectivity is not combined with CA, there is only one primary cell under the primary station and only one primary and secondary cell under the secondary station. This scenario is also applicable to the embodiments of the present application.

[0171] It should be understood that for the sake of ease of description, FIG2 is illustrated by taking the example of each cell group including 2 SCells.

[0172] In the DC scenario, the terminal device will have the process of adding or changing the PSCell. The addition of a PSCell triggered by the terminal device is called conditional PSCell addition (CPA), and the change of a PSCell triggered by the terminal device is called conditional PSCell change (CPC). Among them, CPA can be understood as the conditional addition of PSCell. When the terminal device meets the conditions for adding PSCell, the terminal device performs the process of adding PSCell. CPC can be understood as the conditional change of PSCell. When the terminal device meets the conditions for changing PSCell, the terminal device performs the process of changing PSCell. Specifically, as an example, CPA and CPC can also be collectively referred to as conditional PSCell addition and change (CPAC). That is, the network configuration will configure multiple candidate PSCells and send the CPAC configuration to the terminal device. The CPAC configuration includes the configuration of the multiple candidate PSCells and the corresponding execution conditions. When the terminal device evaluates that the execution conditions of a candidate PSCell are met, the terminal device can perform the PSCell addition or change process. The cell that meets the execution conditions can become the selected cell.

[0173] After the terminal device completes the above-mentioned CPA or CPC process and establishes a connection with a candidate PSCell that meets the conditions (for example, a random access channel (RACH)), the terminal device will release the CPA configuration and / or CPC configuration. Therefore, before the network is reconfigured or the network is restarted, the terminal device cannot continue to use the CPA configuration and / or CPC configuration. In order to reduce the delay and signaling overhead of the secondary cell group change, the terminal device may not release the CPA configuration and / or CPC configuration. Before the network is reconfigured or the network is restarted, the terminal device continues to use the previously stored CPA configuration or CPC configuration, thereby continuing to execute the CPA or CPC process.

[0174] For ease of description, CPA or CPC may be collectively referred to as CPAC in this application. CPA configuration or CPC configuration may be collectively referred to as CPAC configuration.

[0175] For example, consider a terminal device executing the CPC procedure. Assume that the terminal device is currently communicating with the mobile node (MN) and cell 0 under the network node (SN) (possibly with other SCells). Cell 0 is the terminal device's PSCell at this time. Assume that the terminal device receives a CPC configuration, which includes configuration information for candidate cells 1 through 3, as well as the corresponding execution conditions for each of these candidate cells. When the terminal device detects that the execution conditions for candidate cell 3 are met, it can execute the CPC procedure, changing the PSCell from cell 0 to candidate cell 3. After completing the connection with candidate cell 3, the terminal device does not release the CPC configuration but instead continues to maintain the CPC configuration and execute the CPC procedure. The terminal device can also continue to evaluate other candidate cells based on the stored CPC configuration. When another candidate cell meets the execution conditions, the terminal device should trigger the CPC procedure again. For example, if the terminal device subsequently detects that candidate cell 1 meets the execution conditions, it will switch the PSCell from candidate cell 3 to candidate cell 1 and complete the connection with candidate cell 1.

[0176] In order to prevent data from being eavesdropped and / or tampered, the communication between the terminal device and the network device can be encrypted and / or integrity protected based on the security key. In the above DC scenario, for example, the communication between the terminal device and the MN is based on the master key (e.g., K gNB or K eNB ) derived from the control plane key (radio resource control (RRC) key, such as the integrity protection key K RRCint and encryption / decryption key K RRCenc) and / or keys for the user plane (UP keys, such as integrity protection keys K UPint and encryption / decryption key K UPenc In another example, the communication between the terminal device and the SN is based on a secondary key (e.g., K SN , SK gNB or SK eNB , K is used uniformly below. SN Description) derived keys for the control plane and / or keys for the user plane. SN Based on K gNB , using the key derived from the SN counter (or sk-counter, hereinafter referred to as SN counter), where the SN counter is an SN counter associated with the current security context. SN Or update K SN When MN generates or updates SN Counter and sends it to UE. MN and UE use the same master key and SN Counter to derive the same K SN It should be understood that in addition to SN Counter, K SN The input parameters may also include other parameters, such as the length of SN Counter, etc. The MN sends the derived KSN to the secondary station to be added or accessed, thereby realizing KSN between the terminal device and the secondary station. SN Alignment, so that the terminal equipment and auxiliary station use the same K SN Derive the same integrity and / or encryption and decryption keys to ensure the security of communication between the two.

[0177] In order to reduce the delay and signaling overhead of the change, the terminal device does not release the CPAC configuration. Before the network is reconfigured or restarted, the terminal device continues to use the previously stored CPAC configuration. Although the above process can reduce the delay and signaling overhead of the secondary cell group change, when the terminal device continues to execute CPAC according to the CPAC configuration, there will be a key reuse problem when the terminal device communicates with the PSCell under the SN, which makes the communication process between the terminal device and the PSCell under the SN unsafe.

[0178] It should be understood that key reuse means that the terminal device uses the same key to encrypt / integrity protect communication data packets more than once (for example, twice). If an attacker obtains two or more ciphertexts encrypted / integrity protected with the same key, there is a risk of plaintext being disclosed.

[0179] For example, assume that the CPAC configuration includes the configuration and execution conditions for candidate cell 1, candidate cell 2, candidate cell 3, and an SN Counter. Alternatively, the CPAC configuration includes the configuration, execution conditions, and SN Counter #1 for candidate cell 1; the configuration, execution conditions, and SN Counter #2 for candidate PSCell 2; and the configuration, execution conditions, and SN Counter #3 for candidate PSCell 3. The SN Counters associated with each candidate cell are equal, i.e., SN Counter #1 = SN Counter #2 = SN Counter #3.

[0180] FIG3 is a schematic diagram of a key reuse in the prior art. As shown in FIG3, after the terminal device completes the first CPA or CPC (the K used this time) SN Based on K gNB and SN Counter (or SN Counter#1), when the terminal device triggers CPC again, due to the K associated with each candidate cell in the CPAC configuration gNB and SN Counter (or SN Counter #1) have not changed, the K used this time is SN No change, still complete the first CPA or CPC with the terminal device using K SN The same. Thus, based on the same K SN The derived keys for the user plane and control plane are also the same, which poses a risk of key stream reuse.

[0181] For another example, assume that the CPAC configuration includes the configuration, execution conditions, and SN Counter #1 for candidate cell 1; the configuration, execution conditions, and SN Counter #2 for candidate cell 2; and the configuration, execution conditions, and SN Counter #3 for candidate cell 3. The SN Counters associated with candidate cells under different SNs or with each candidate cell are not equal, for example, SN Counter #1 ≠ SN Counter #2 ≠ SN Counter #3.

[0182] FIG4 is a schematic diagram of another key reuse method in the prior art. As shown in FIG4, after the first CPA or CPC is completed between the terminal device and the candidate cell 1 (the K used this time is SN Based on K gNB and SN Counter#1). If the terminal device subsequently triggers a change to the candidate cell 1 again, due to K gNB and SN Counter#1 are the same as those used when accessing the candidate cell 1 last time. Therefore, the K used this time isSN Or based on the K used in the last access to candidate cell 1 SN The same. Thus, based on the same K SN The derived keys for the user plane and control plane are also the same, which poses a risk of key stream reuse.

[0183] In the prior art, whether to reconstruct the packet data convergence protocol (PDCP) is indicated by the network device. For example, the network device instructs the UE whether to perform the PDCP reconstruction process when switching the PSCell through the reestablishPDCP indication information. It should be understood that if the key needs to be changed during the switching process, the network device needs to instruct the terminal device to perform PDCP reconstruction and complete the key change during the PDCP reconstruction process. Therefore, in the scenario of continuous CPAC, the network device needs to indicate whether to perform PDCP reconstruction each time the switch is made, or whether to change the key each time the switch is made. It can also be done in the following ways:

[0184] Method 1: Indicated by means of candidate cell groups (or cell sets): The network provides multiple cell sets to the UE, each of which includes one or more cells. Each cell set corresponds to the same SN Counter. If the source cell and target cell of the UE belong to the same cell set, the UE does not perform PDCP reconstruction during handover, that is, it does not perform new key derivation. If the source cell and target cell of the UE belong to different cell sets, the UE must perform PDCP reconstruction and new key derivation during handover. The SN Counter values ​​of the cells in the cell set are the same. The SN Counter of a cell set can be one or more.

[0185] Method 2: The network configures an associated SN Counter for each candidate cell. The number of associated SN Counters configured for each cell can be one or more (i.e., an SN Counter set). The SN Counters associated with different candidate cells can be the same or different. If the SN Counters of the source cell and the target cell to which the UE switches are the same, the UE does not need to perform PDCP re-establishment, that is, it does not need to derive a new key; if the SN Counters / SN Counter sets of the source cell and the target cell to which the UE switches are different, the UE needs to perform PDCP re-establishment, that is, the UE needs to derive a new key.

[0186] Method 3: The network configures an associated SN Counter for each candidate cell. The number of associated SN Counters configured for each cell can be one or more (i.e., an SN Counter set). The SN Counters associated with different candidate cells can be the same or different. The network instructs the UE whether to perform PDCP re-establishment when switching from a certain cell to another. For example, there are three candidate cells (cell 1, cell 2, and cell 3). The network instructs the UE whether PDCP re-establishment is required when switching from cell 1 to cell 2, from cell 2 to cell 1, from cell 1 to cell 3, from cell 3 to cell 1, from cell 2 to cell 3, and from cell 3 to cell 2. If the network indicates that PDCP re-establishment is required, the UE needs to perform PDCP re-establishment, that is, the UE needs to derive a new key. If the network indicates that PDCP re-establishment is not required, the UE does not need to perform PDCP re-establishment, that is, the UE does not need to derive a new key.

[0187] Method 4: The network associates a third identifier with each candidate cell or each candidate cell configuration. Optionally, the third identifier is used to control whether PDCP is rebuilt, or the third identifier is used to control whether a key change is performed, or the third identifier is used to indicate security parameters associated with the candidate cell, or the third identifier is used to indicate whether the security parameters associated with the candidate cell are the same. If the third identifiers associated with the source cell and the target cell of the UE are the same, the UE does not perform PDCP reconstruction or does not perform new key deduction when switching. If the third identifiers associated with the source cell and the target cell of the UE are different, the UE must perform PDCP reconstruction or perform new key deduction when switching. It can be understood that the SN Counter of the candidate cells associated with the same third identifier is also the same.

[0188] Taking the above-mentioned method 1 as an example, if the UE switches to a cell included in a certain cell set again, the SN Counter used for deducing the key is still the SN Counter corresponding to the cell set, and there is also a risk of key stream reuse.

[0189] In view of this, an embodiment of the present application provides a communication method that can avoid the problem of key reuse in a CPAC scenario.

[0190] Figure 5 is a schematic flow chart of a communication method provided by an embodiment of the present application. As shown in Figure 5, the method may include steps 510-520, and steps 510-520 are described in detail below.

[0191] Step 510: Derive a first key, where the first key is based on the second key and determined using a first parameter value.

[0192] As an example, in the embodiment of the present application, the first key can be derived based on the second key and using the first parameter value. Specifically, the terminal device can derive the first key based on the second key and using the first parameter value. The first key can be a secondary key, such as K SN , SK gNB or SK eNB It should be understood that deriving the first key may also be referred to as deducing the first key, or deducing the first key, or determining the first key, or obtaining the first key, etc.

[0193] It should be noted that the terminal device can evaluate whether the execution condition of the first cell is met, and the first cell can be a candidate cell added or changed to the conditional cell. If the terminal device evaluates that the execution condition of the first cell is met, or the terminal device accesses a candidate cell that meets the execution condition, the terminal device can determine the first parameter value and derive the first key using the first parameter value.

[0194] The second key may be a master key between the terminal device and the MN, for example, K gNB , or K eNB . The master key is used to derive the control plane key and / or the user plane key, and the control plane key and / or the user plane key are used to encrypt or protect the data integrity of the data and / or signaling between the terminal device and the MN. For example, the control plane key is used to encrypt or protect the data integrity of the signaling between the terminal device and the MN. For another example, the user plane key is used to encrypt or protect the data integrity of the data between the terminal device and the MN.

[0195] The first key can be a Secondary key, such as K SN , SK gNB or SK eNB . The first key is used to derive the control plane key and / or the user plane key, and the control plane key and / or the user plane key are used to encrypt or protect the data integrity of the data and / or signaling between the terminal device and the SN. For example, the control plane key is used to encrypt or protect the data integrity of the signaling between the terminal device and the SN. For another example, the user plane key is used to encrypt or protect the data integrity of the data between the terminal device and the SN.

[0196] There are many ways to determine the value of the first parameter, which are not specifically limited in the present embodiment. Several possible implementations are described below with examples.

[0197] In one possible implementation, the first parameter value may be obtained based on an update of the second parameter value. For example, the first parameter value is the second parameter value plus N, where N is an integer greater than or equal to 1, or N is the maximum number of candidate cells added or changed in the conditional cell. Before the terminal device derives the first key, for example, if the terminal device evaluates that a candidate cell meets the execution condition, the terminal device updates the second parameter value to the first parameter value. For example, the terminal device detects that candidate cell 1 meets the corresponding execution condition, or before the terminal device accesses candidate cell 1, the terminal device updates the SN Counter to SN Counter+1. This implementation method will be described in detail below in conjunction with Figure 6 and will not be described in detail here.

[0198] In one example, the second parameter value is the parameter value last used in the first cell or the secondary station to which the first cell belongs (or, the second parameter value is the parameter value last used by the terminal device in the first cell or the secondary station to which the first cell belongs), or the second parameter value is the parameter value used for the last access (or, the second parameter value is the parameter value used last).

[0199] In another example, the second parameter value is the parameter value last used by the cells in the first cell set, wherein the first cell set includes the first cell. That is, the terminal device maintains an SN Counter for the cells in the first cell set. In other words, the second parameter values ​​(e.g., SN Counter) of the cells in the first cell set are the same. When the terminal device switches from a cell in another cell set to a cell in the first cell set, the terminal device derives a first key. The first key derived by the terminal device is determined based on the first parameter. The first parameter is updated based on the second parameter, and the second parameter is the SN Counter last used by the cells in the first cell set. Exemplarily, the first cell set is used to instruct the terminal device to perform PDCP reconstruction. For example, when the terminal device switches from a cell in the first cell set to another cell in the first cell set, PDCP reconstruction does not need to be performed; when the terminal device switches from a cell outside the first cell set to a cell in the first cell set, PDCP reconstruction needs to be performed. Optionally, the first cell set is a set of cells associated with the same third identifier, or the first cell set is a set of cells belonging to the same secondary station.

[0200] In another example, the second parameter value is the parameter value last used by the third cell, where the third cell is configured with the same SN Counter as the first cell. That is, the terminal device maintains an SN Counter for each candidate cell. The SN Counters of different candidate cells can be the same or different. When the terminal device switches from another cell to the first cell, if the SN Counters of the two cells are different, the terminal device derives a first key. The first key derived by the UE is implemented based on the first parameter value. The first parameter is updated based on the second parameter value, and the second parameter value is the SN Counter value last used by the cell with the same SN Counter as the first cell. As an example, the third cell can also be the first cell.

[0201] In another possible implementation, the first parameter value is determined based on the third parameter value and the number of times the first cell or the secondary station to which the first cell belongs is accessed, wherein the third parameter value is the starting parameter value associated with the first cell or the secondary station to which the first cell belongs. Before the terminal device derives the first key, for example, if the terminal device evaluates that a candidate cell meets the execution condition, the terminal device updates the first parameter value based on the third parameter value and the number of times the first cell or the secondary station to which the first cell belongs is accessed. For example, the terminal device detects that candidate cell 2 meets the corresponding execution condition, or before the terminal device accesses candidate cell 2, the terminal device updates the SN Counter to the starting value of the SN Counter of candidate cell 2 or the secondary station to which the candidate cell belongs plus (the number of times the terminal device accesses candidate cell 2 or the secondary station to which candidate cell 2 belongs - 1). This implementation method will be described in detail below in conjunction with Figure 7 and will not be described in detail here.

[0202] In another possible implementation, the first parameter value is determined based on a third parameter value and the number of times a cell in a first cell set is accessed, where the third parameter value is a starting parameter value associated with the first cell set. The first cell set includes the first cell. That is, the terminal device maintains an SN Counter for the first cell set. When the terminal device switches from a cell in another cell set to a cell in the first cell set, the terminal device derives a first key. Before deriving the first key, for example, if the terminal device assesses that a candidate cell meets an execution condition, the terminal device updates the first parameter value based on the third parameter value and the number of times a cell in the first cell set is accessed. For example, if the terminal device detects that candidate cell 2 meets the corresponding execution condition, or before the terminal device accesses candidate cell 2, the terminal device updates the SN Counter to the starting value of the SN Counter of the cell set containing candidate cell 2 plus (the number of times the terminal device accesses the cell set - 1). Optionally, the available parameter values ​​associated with the first cell set are limited. For example, in addition to configuring the starting parameter value associated with the first cell set, the network device also configures the maximum number of parameter values ​​available for the first cell set.

[0203] Optionally, the first cell set includes cells associated with the same third identifier. The third identifier can be used to control whether PDCP is reestablished, or the third identifier is used to control whether a key change is performed, or the third identifier is used to indicate security parameters (e.g., SN Counter) associated with the candidate cells, or the third identifier is used to indicate whether security parameters (e.g., SN Counter) associated with the candidate cells are the same.

[0204] If multiple parameter values ​​associated with the first cell set are all used, one possible solution is that when the terminal device performs a cell change to a cell outside the first cell set after the multiple parameters are used, the terminal device releases or suspends the configuration information of the cell in the first cell set. It can be understood that releasing or suspending the configuration information of the cell means excluding the cell from the candidate cells. Another possible solution is that the terminal device no longer selects a cell in the first cell set as the target cell after the multiple parameters are used, for example, the terminal device no longer evaluates the cells in the first cell set. Through the above possible solution, it can be ensured that after the multiple parameters associated with the cell are all used, the terminal device will not have the problem of key reuse, and it also allows possible switching within the cell set without changing the key. Another possible solution is that when the terminal device has used multiple parameters associated with the first cell set, when the terminal device subsequently accesses a cell in the first cell set, the secondary station terminated (SN-terminated) radio bearer of the cell is not used, that is, it can be understood that the terminal device no longer uses the PDCP entity of the secondary station where the cell is located. The secondary station terminated radio bearer includes the radio bearer of the primary cell group and the radio bearer of the secondary cell group. Through this possible solution, the terminal device is allowed to continue to use cells in the first cell set as candidate cells or target cells, but avoids the key reuse problem of the secondary station. Optionally, the prerequisite for the terminal device to access such a cell again is that the signal quality of the terminal device's current serving cell is lower than or equal to a certain threshold, and / or the terminal device assesses that other candidate cells do not meet the execution conditions (for example, within a certain time).

[0205] This implementation will be described in detail below with reference to FIG7 and will not be described in detail here.

[0206] In another possible implementation, the first parameter value may be the Pth value in the first set, where P is related to the number of accesses to the first cell or the secondary station to which the first cell belongs, and the first set includes multiple parameter values ​​associated with the first cell or the secondary station to which the first cell belongs. This implementation will be described in detail below in conjunction with FIG8 and is not described in detail here.

[0207] Optionally, the terminal device deletes the used first parameter value from the first set. For example, after the terminal device sets a parameter value in the first set as the first parameter value, it deletes the parameter value from the first set.

[0208] If multiple parameter values ​​in the first set are all used, one possible solution is that when the terminal device performs a cell change to a cell other than the first cell after the multiple parameters are used, the terminal device releases or suspends the configuration information of the first cell; or when the terminal device performs a cell change to a cell other than the cell under the secondary station to which the first cell belongs after the multiple parameters are used, the terminal device releases or suspends the configuration information of the cell under the secondary station to which the first cell belongs. It can be understood that releasing or suspending the configuration information of a cell means excluding the cell from candidate cells. Another possible solution is that after the multiple parameters are used, the terminal device no longer selects the first cell as the target cell, for example, the terminal device no longer evaluates the first cell; or after the multiple parameters are used, the terminal device no longer selects the cell under the secondary station to which the first cell belongs as the target cell, for example, the terminal device no longer evaluates the cell under the secondary station to which the first cell belongs. Through the above possible solutions, it can be ensured that after the multiple parameters associated with the cell are all used, the terminal device will not encounter the problem of key reuse, and it also allows possible intra-cell handover or intra-secondary station handover without changing the key. Another possible solution is that, when the terminal device uses multiple parameters associated with the first cell, when the terminal device subsequently accesses the first cell, the SN-terminated radio bearer of the cell is not used, which can be understood as the terminal device no longer using the PDCP entity of the secondary station. Or, when the terminal device uses multiple parameters associated with the secondary station to which the first cell belongs, when the terminal device subsequently accesses the cell under the secondary station to which the first cell belongs, the SN-terminated radio bearer of the cell is not used, which can be understood as the terminal device no longer using the PDCP entity of the secondary station. The radio bearers terminated by the secondary station include the radio bearers of the primary cell group and the radio bearers of the secondary cell group. Through this possible solution, the terminal device is allowed to continue to use the first cell or the cell under the secondary station to which the first cell belongs as a candidate cell or target cell, but avoids the key reuse problem of the secondary station. Optionally, the prerequisite for the terminal device to access such a cell again is that the signal quality of the terminal device's current serving cell is lower than or equal to a certain threshold, and / or the terminal device evaluates that other candidate cells do not meet the execution conditions (for example, within a certain time).

[0209] In another possible implementation, the first parameter value is selected from a third set, where the third set includes multiple parameter values ​​associated with the first cell set, including the first parameter value. In one example, the first parameter value is randomly selected from unused parameter values ​​in the third set. In another example, the first parameter value is selected sequentially from largest to smallest, or from smallest to largest, according to the parameter values ​​in the third set. In another example, the first parameter value is the Pth value in the third set, where P is related to the number of accesses to the first cell or the secondary station to which the first cell belongs. In another example, the first parameter value is selected sequentially from the first to last, or from last to first, according to the parameter values ​​in the third set. That is, the terminal device maintains a set of SN counters for the first cell set. When the terminal device switches from a cell outside the first cell set to the first cell, the terminal device derives the first key. The terminal device selects an unused SN counter from the SN counter set of the first cell set and derives a new key. The selection rule may be to select in sequence according to the number of times the UE accesses the cell set, or to select randomly (regardless of the number of times the UE accesses the cell set), and it is necessary to ensure that the SN Counter selected each time is not repeated.

[0210] For another example, the terminal device deletes the used first parameter value from the third set. After the terminal device sets the first parameter value to a parameter value in the third set, the terminal device deletes the parameter value from the third set. When the terminal device switches from a cell outside the first cell set to the first cell, the terminal device uses the first parameter value in the third set as the first parameter value and uses the first parameter value to derive the first key.

[0211] A possible solution is that if multiple parameter values ​​in the third set are all used, when the terminal device performs a cell change to a cell outside the first cell set after the multiple parameters are used, the terminal device releases or suspends the configuration information of the cell in the first cell set. A possible solution is that if multiple parameter values ​​in the third set are all used, the terminal device no longer selects a cell in the first cell set as the target cell after the multiple parameters are used, for example, the terminal device no longer evaluates the cells in the first cell set. Through the above possible solution, it can be ensured that after multiple parameters associated with the cell are all used, the terminal device will not have the problem of key reuse, and it also allows possible switching within the set without changing the key. Another possible solution is that when the terminal device uses multiple parameters associated with the first cell set, when the terminal device subsequently accesses a cell in the first cell set, the SN-terminated radio bearer of the cell is not used, which can be understood as the terminal device no longer using the PDCP entity of the secondary station. The secondary station-terminated radio bearer includes the radio bearer of the primary cell group and the radio bearer of the secondary cell group. Through this possible solution, the terminal device is allowed to continue to use cells in the first cell set as candidate cells or target cells, but avoids the key reuse problem of the secondary station. Optionally, the prerequisite for the terminal device to access such a cell again is that the signal quality of the terminal device's current serving cell is lower than or equal to a certain threshold, and / or the terminal device assesses that other candidate cells do not meet the execution conditions (for example, within a certain time).

[0212] Exemplarily, the first cell set may be configured by a network device, for example, indicating identifiers of candidate cells included in the first cell set.

[0213] Exemplarily, the first cell set may be a set of implicitly associated cells, for example, the first cell set may be a set of cells associated with the same third identifier, or the first cell set may be a set of cells configured with the same SN Counter.

[0214] Exemplarily, the first cell set is not configured by the network device. The first cell set includes cells having the same second parameter value set (for example, SN Counter set). In this example, the first parameter value is selected from a third set, and the third set includes multiple parameter values, and the multiple parameter values ​​include the first parameter value. Multiple candidate cells can be associated with the third set. In the case where the terminal device switches from a cell associated with a non-third set to a cell associated with the third set, the terminal device deduces the first key. Alternatively, the first cell set includes cells associated with the same third identifier.

[0215] It should be understood that the first parameter value, the second parameter value, and the third parameter value may be different values ​​of the parameter SN Counter.

[0216] Step 520: Derive a third key based on the first key, where the third key is a user plane key and / or a control plane key.

[0217] In the embodiment of the present application, a third key may be derived from the first key, that is, the third key is a user plane key and / or a control plane key derived from the first key. The control plane key and / or the user plane key is used to encrypt or protect the data integrity of data and / or signaling between the terminal device and the first cell. The user plane key is used to encrypt or protect the data integrity of data between the terminal device and the first cell.

[0218] In the above technical solution, a new first parameter value can be obtained by updating the second parameter value, or a new first parameter value can be determined based on the number of times the first cell or the secondary station to which the first cell belongs is accessed, or an unused parameter value can be selected from multiple parameter values, so that each time the terminal device accesses a cell, a new parameter value can be determined, and a new key can be derived based on the new parameter value, thereby avoiding the problem of key reuse in the process of switching candidate cells.

[0219] It should be understood that other input parameters may also be used to derive the third key based on the first key, such as one or more of the security algorithm type identifier, the length of the security algorithm type identifier, the security algorithm identifier, and the length of the security algorithm identifier.

[0220] Optionally, in some embodiments, the terminal device may further send the determined first parameter value to the MN. Specifically, the terminal device may send a first message to the master station MN, where the first message indicates the first cell that meets the execution condition or the secondary station to which the first cell belongs, and the first message may include the first parameter value. That is, the first message includes both indication information indicating the first cell that meets the execution condition or the secondary station to which the first cell belongs, and the first parameter value. For example, the first message may be an RRC reconfiguration completion message. After receiving the first message sent by the UE, the MN may derive K based on the first parameter value included in the first message. SN , and the derived K SN Send to SN, SN will receive K SNUsed for secure communication with the UE. In this implementation, if the MN believes that multiple SN Counters configured for the UE are about to be exhausted or have all been used, the MN may initiate an SN Counter update procedure, for example, by configuring a new SN Counter for the UE via an RRC reconfiguration message. Alternatively, if multiple SN Counters are about to be exhausted or have all been used, the UE may request the MN to update the SN Counter. Optionally, the UE may indicate to the MN that the reason for the request is that the SN Counter is about to be exhausted or has been exhausted.

[0221] In some embodiments, the MN may include multiple possible K SN The Xth message may be a SN add request message. After receiving the first parameter value in the first message, the MN sends a third message to the SN, wherein the third message is used to instruct the SN to use multiple K SN The specific K in SN In this implementation, if the SN considers that the received K SN If all the K SN This request message is used to request multiple K SN Alternatively, if the MN believes that multiple SN Counters configured for the UE are about to be used up or all used, the MN can initiate an SN Counter update process. For example, the MN configures a new SN Counter for the UE through an RRC reconfiguration message. The MN can also use the new SN Counter to correspond to the derived K SN Alternatively, when multiple SN Counters are about to be used up or all are used up, the UE requests the MN to update the SN Counter. Optionally, the UE may indicate to the MN that the reason for the request is that the SN Counter is about to be used up or has been used up.

[0222] It should be noted that the MN can update the first parameter value based on the second parameter value, or determine the first parameter value based on the number of times the terminal device accesses the first cell or the secondary station to which the first cell belongs, or determine the first parameter value from multiple parameters according to the aforementioned rules. At this time, the first message sent by the terminal device to the MN does not include the first parameter value.

[0223] In one possible implementation, the implementation process of the MN determining the first parameter value is the same as the process of the terminal device obtaining the first parameter value in step 510. For details, please refer to the description in step 510, which will not be repeated here. The MN can also derive the first key based on the second key and using the first parameter value. After deriving the first key, the MN can also send the first key to the first cell or the secondary station to which the first cell belongs. In this implementation, if the MN believes that multiple SN Counters configured for the UE are about to be used up or all used, the MN can initiate an SN Counter update process. For example, the MN configures a new SN Counter for the UE through an RRC reconfiguration message. The MN can also use the new SN Counter to derive the K SN Sent to the SN. Alternatively, when multiple SN counters are about to be exhausted or have all been used, the UE requests the MN to update the SN counter. Optionally, the UE may indicate to the MN that the reason for the request is that the SN counter is about to be exhausted or has been exhausted. In this implementation, it is also necessary to consider how to ensure alignment of the first parameter values ​​used by the terminal device and the MN. That is, if the terminal device fails to access the first cell, how to ensure that the same first parameter value is used by the terminal device and the MN during subsequent cell changes. In one example, the terminal device sends a first indication to the MN, where the first indication indicates whether to update the first parameter value. When the first indication indicates an update to the first parameter value, the MN uses the new first parameter value and derives the first key based on the second key and the new first parameter value. When the first indication indicates no update to the first parameter value, the MN uses the original first parameter value and derives the first key based on the second key and the original first parameter value. In another example, the UE should release the configuration information of the candidate cell. In yet another example, the terminal device and the MN should consider the first parameter value to be in use, or that the first parameter value is determined based on the number of attempts to access the first cell, the secondary station to which the first cell belongs, or a cell in the first cell set. As long as the MN successfully receives the RRC reconfiguration complete message, the corresponding first parameter value is considered to have been used. In another example, the SN sends a second indication to the MN, and the second indication is used to indicate whether the terminal device access is successful or whether the first key is valid. For example, when the terminal device fails to access the first cell, the SN to which the first cell belongs indicates the access failure to the MN or indicates that the first key cannot be valid. The terminal device and the MN consider that the first parameter value is not used during subsequent cell changes.

[0224] In one possible implementation, the MN sends a second set to the first cell or the secondary station to which the first cell belongs, and the second set includes multiple keys associated with the first cell or the secondary station to which the first cell belongs, and the multiple keys include the above-mentioned first key. After receiving the second set, the secondary station can determine the first key from the second set according to the first identifier or the number of times the terminal device accesses the first cell or the secondary station to which the first cell belongs. The first identifier is used to indicate the first key in the second set. Or the secondary station can determine the first key by the rule for determining the first parameter value in step S501. For example, the first key is determined in sequence from the front to the back or from the back to the front from the second set. This implementation will be described in detail below in conjunction with Figure 8 and will not be described in detail here. In this implementation, if the SN believes that the K in the received second set SN If all the K SN Alternatively, when multiple SN Counters are about to be used up or all are used up, the UE requests the MN to update the SN Counter. Optionally, the UE may indicate to the MN that the reason for the request is that the SN Counter is about to be used up or has been used up. This request message is used to request multiple K SN In this implementation, it is also necessary to consider how to ensure that the first parameter value used by the terminal device is aligned with the first key used by the SN, that is, if the terminal device fails to access the first cell, how to ensure that the terminal device side and the SN side use the same first key when the cell is subsequently changed. In one example, the terminal device can use the first identifier to indicate the first key used by the cell change; in another example, if the terminal device fails to access the first cell, the terminal device believes that the corresponding first parameter value is not used, that is, the terminal device falls back to the first parameter value used before. Accordingly, the SN to which the first cell belongs believes that the corresponding first key is not used.

[0225] It should be understood that the embodiments of the present application do not specifically limit the number of candidate SNs and the number of candidate cells included under each candidate SN. For ease of description, the following example is provided in which two candidate SNs (candidate SN1 and candidate SN2) are included, and candidate SN1 includes candidate cells 1, candidate cell 2, and candidate cell 3, and candidate SN2 includes candidate cells 4, candidate cell 5, and candidate cell 6.

[0226] The specific implementation process of updating the first parameter value in step 510 is described in detail below with reference to FIG6 . It should be understood that the example in FIG6 is merely intended to help those skilled in the art understand the embodiments of the present application and is not intended to limit the embodiments of the present application to the specific numerical values ​​or specific scenarios illustrated. It is apparent that those skilled in the art can make various equivalent modifications or variations based on the following example provided in FIG6 , and such modifications and variations also fall within the scope of the embodiments of the present application.

[0227] Figure 6 is a schematic flow chart of another communication method provided by an embodiment of the present application. As shown in Figure 6, the method may include steps 610-699, which are described in detail below.

[0228] Step 610: The terminal device establishes an RRC connection with the MN.

[0229] Step 615: The terminal device establishes an RRC connection with the source SN.

[0230] It should be noted that step 615 is optional.

[0231] As an example, if the terminal device is performing a CPC process, that is, the terminal device has established a connection with a cell under the source SN, that is, the UE has a serving PSCell, then the terminal device needs to perform a PSCell change process according to the execution conditions. In this implementation, the terminal device can also establish an RRC connection with the source SN.

[0232] As an example, if the terminal device performs the CPA process, that is, the terminal device performs the PSCell addition process according to the execution conditions, in this implementation mode, the terminal device can only establish an RRC connection with the MN, and there is no need to execute step 615 to establish an RRC connection with the source SN.

[0233] Step 620: MN sends SN add request message 1 to candidate SN1. The SN add request message 1 includes K SN1 .

[0234] As an example, in this embodiment, each candidate cell included in the candidate SN1 corresponds to an SN Counter1, that is, the SN Countere corresponding to each candidate cell is the same. gNB And SN Counter calculates K SN1 The MN may also send an SN add request message 1 to the candidate SN1 or the candidate cells under the candidate SN1 (eg, candidate cell 1, candidate cell 2, candidate cell 3), wherein the SN add request message 1 includes K SN1 Among them, K gNB The key used for communication between the MN and the terminal device corresponds to the master key mentioned above. gNB , SN Counter and SN Counter length and other parameters to calculate K SN1 .

[0235] It should be understood that SN Counter1 may correspond to the second parameter value mentioned above.

[0236] Step 625: The candidate SN1 sends an SN add request confirmation message 1 to the MN.

[0237] In an embodiment of the present application, after the candidate SN1 receives the SN add request message 1 sent by the MN, if the candidate SN1 confirms that resources can be allocated to the candidate cells included therein, the candidate SN1 can send an SN add request confirmation message 1 to the MN, and the SN add request confirmation message 1 indicates that the candidate SN1 confirms that it can be added as a candidate SN.

[0238] Step 630: The MN sends an SN add request message 2 to the candidate SN2.

[0239] As an example, in this embodiment, each candidate cell included in the candidate SN2 corresponds to an SN Counter1, that is, the SN Countere corresponding to each candidate cell is the same. gNB And SN Counter calculates K SN1 MN can also send SN add request message 2 to candidate SN2 or candidate cells under candidate SN2 (for example, candidate cell 4, candidate cell 5, candidate cell 6), and the SN add request message 2 includes K SN1 .

[0240] Step 635: Candidate SN2 sends an SN add request confirmation message 2 to the MN.

[0241] In an embodiment of the present application, after candidate SN2 receives the SN add request message 2 sent by MN, if the candidate SN1 confirms that resources can be allocated to the candidate cells included therein, the candidate SN2 can send an SN add request confirmation message 2 to MN, and the SN add request confirmation message 2 indicates that the candidate SN2 confirms that it can be added as a candidate SN.

[0242] It should be understood that there is no limitation on the execution order between steps 620 and 630 and between steps 625 and 635 .

[0243] Step 640: The MN sends an RRC reconfiguration message to the terminal device.

[0244] The RRC reconfiguration message sent by the MN to the terminal device may include a CPAC configuration, which may include the configuration and corresponding execution conditions of each candidate cell included in candidate SN1 and candidate SN2, as well as SN Counter 1. Specifically, as an example, the CPAC configuration includes the configuration and corresponding execution conditions of candidate cells 1 to 6, as well as SN Counter 1.

[0245] Step 645: The terminal device replies with an RRC reconfiguration completion message 1 to the MN.

[0246] After receiving the RRC reconfiguration message from the MN and successfully completing the reconfiguration, the terminal device replies with an RRC reconfiguration completion message 1 to the MN.

[0247] Step 650: The terminal device evaluates whether the candidate cells included in the CPAC configuration meet the execution conditions.

[0248] After receiving the CPAC configuration sent by the MN, the terminal device can start to evaluate the execution conditions included in the CPAC configuration to determine whether the candidate cells included in the CPAC configuration meet the execution conditions.

[0249] Step 655: The terminal device determines K according to SN Counter1 included in the CPAC configuration. SN1 .

[0250] If the terminal device detects that the execution conditions of a candidate cell are met, or the terminal device is about to access a candidate cell that meets the execution conditions, the terminal device can derive K based on the master key and use the SN Counter1 included in the CPAC configuration. SN1 The terminal device saves K SN1 , and can be based on K SN1 Derive the user plane key for encrypting data or protecting data integrity between the candidate cell 1, and also can be based on K SN1 A control plane key for encrypting signaling or protecting data integrity with the candidate cell 1 is derived.

[0251] Step 660: The terminal device sends an RRC reconfiguration complete message 2 to the MN. The RRC reconfiguration complete message 2 includes an RRC reconfiguration complete message sent to the candidate SN1.

[0252] If the terminal device determines that the execution conditions of a candidate cell are met, the terminal device can send an RRC reconfiguration complete message to the MN, and the RRC reconfiguration complete message can indicate the candidate cell selected by the terminal device. As an example, assuming that the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 1, the terminal device can send an RRC reconfiguration complete message 2 to the MN, and the RRC reconfiguration complete message 2 includes an SN reconfiguration complete message sent to candidate SN1 (the candidate SN to which candidate cell 1 belongs). The RRC reconfiguration complete message 2 can indicate that the candidate cell selected by the terminal device is candidate cell 1.

[0253] Step 665: The MN forwards the SN reconfiguration completion message to the candidate SN1.

[0254] In an embodiment of the present application, after receiving the RRC reconfiguration completion message 2 sent by the terminal device, the MN can determine based on the message that the terminal device has selected the candidate cell 1, and the MN forwards the SN reconfiguration completion message to the candidate SN1 where the candidate cell 1 is located.

[0255] It should be noted that the present application does not impose any specific restrictions on the execution order of step 655, step 660 and step 665. Step 655 may be executed first, and then step 660 and step 665; or, step 660 and step 665 may be executed first, and then step 655; or, step 655, step 660 and step 665 may be executed simultaneously. SN1 According to K SN1 The derivation of integrity protection or encryption / decryption keys can be performed continuously or separately. For example, the terminal device first derives K SN1 , before or after executing the following step 670, according to K SN1 Derive integrity protection or encryption and decryption keys.

[0256] Step 667: MN derives K based on the updated SN Counter SN2 .

[0257] Optionally, in some embodiments, the MN may also derive a new key for all candidate SNs (e.g., candidate SN1, candidate SN2) or all candidate cells (e.g., candidate cell 1 to candidate cell 6) after each execution of CPA or CPC. The new key is used for the next triggered CPC process.

[0258] As an example, the MN may update the SN Counter1 included in the CPAC configuration according to the SN Counter update rule to obtain SN Counter2, and use SN Counter2 to derive K SN2 For example, in one possible implementation, the SN Counter update rule is to update the SN Counter to SN Counter+N, where N is a positive integer greater than or equal to 1, or N is the maximum number of candidate cells added or changed for the conditional cell. The terminal device can obtain SN Counter2 based on SN Counter1+N based on the SN Counter update rule, and derive K based on SN Counter2. SN2 .

[0259] Step 668: MN sends the K SN2 .

[0260] MN can use the K derived in step 667 for the next triggered CPC process.SN2 Sent to all candidate cells or candidate SNs to which all candidate cells belong.

[0261] In the above technical solution, after executing a CPA or CPC, the MN can use the key K SN2 Send it to all candidate SNs in advance so that the candidate SNs can obtain the key K in advance during the next CPC process. SN2 , and secure communication with the terminal device is not possible only after receiving the reconfiguration completion message of the MN.

[0262] Step 670: The terminal device performs synchronization with the candidate SN1.

[0263] The terminal device can synchronize to the candidate SN1 where the candidate cell 1 is located. As an example, the synchronization process can be implemented through RACH. The candidate SN1 can also be based on the received K SN1 Derive the user plane key for encrypting data or protecting data integrity between the terminal device, and also can be based on K SN1 Derive the control plane key for encrypting the signaling between the terminal device or protecting the data integrity. SN1 derives the above user plane or control plane key after receiving the K from the MN. SN1 Afterwards, it may also occur before or after the next step 670, or when step 670 is executed.

[0264] It should be noted that the implementation of this application does not specifically limit the execution order of step 667, step 668 and step 670. Step 667 and step 668 can be executed first, and then step 670; or step 670 can be executed first, and then step 667 and step 668; or step 667, step 668 and step 670 can be executed simultaneously.

[0265] Step 673: The terminal device continues to evaluate whether the candidate cells included in the CPAC configuration meet the execution conditions.

[0266] After completing the first CPA or CPC, the terminal device does not release the CPAC configuration. To support subsequent CPC processes, the terminal device retains the CPAC configuration and continues to evaluate candidate cells that meet the execution conditions based on the configuration.

[0267] Step 675: The terminal device derives K based on the updated SN Counter SN2 .

[0268] If the terminal device evaluates a candidate cell that meets the execution conditions, in one possible implementation, the terminal device can update the SN Counter based on the last used SN Counter and use the updated SN Counter to derive a new K SN As an example, assuming that the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 5, the terminal device can update the SN Counter included in the CPAC configuration according to the SN Counter update rule to obtain SN Counter 2. In another possible implementation, the terminal device can also update the SN Counter based on the last used SN Counter of the cell in the cell set where the candidate cell that meets the execution conditions is located, and use the updated SN Counter to derive a new K SN As an example, assuming that the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 5, and candidate cell 5 belongs to cell set 1, the terminal device can update the SN Counter last used by the cell in cell set 1 included in the CPAC configuration according to the SN Counter update rule to obtain SN Counter 2. In another possible implementation, the terminal device can also update the SN Counter based on the SN Counter last used by the cell that is configured with the same SN Counter as the candidate cell that meets the execution conditions, and use the updated SN Counter to derive a new K SN As an example, assuming that the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 5, and candidate cell 5 and candidate cell 10 are configured with the same SN Counter, the terminal device can update the SN Counter last used by candidate cell 10 included in the CPAC configuration according to the SN Counter update rule to obtain SN Counter2.

[0269] For example, in one possible implementation, SN Counter is updated to SN Counter+N, where N is a positive integer greater than or equal to 1. The terminal device can update the SN Counter based on the SN Counter update rule, for example, SN Counter is updated to SN Counter+1, and SN Counter1+1 is added to obtain SN Counter2. The terminal device can also use SN Counter2 to derive K SN2 .

[0270] The terminal device can save K SN2 , and can also be based on K SN2 Derive the user plane key for encrypting data or protecting data integrity between the candidate cell 5, and also can be based on K SN2A control plane key for encrypting signaling with the candidate cell 5 or protecting data integrity is derived.

[0271] It should be understood that SN Counter1 may correspond to the second parameter value mentioned above, SN Counter2 may correspond to the first parameter value mentioned above, and K SN2 The user plane key and / or control plane key may correspond to the third key mentioned above.

[0272] It should be understood that the terminal device does not necessarily update the SN Counter and derive the K immediately after evaluating the candidate cell that meets the execution conditions. SN For example, the terminal device can update the SN Counter before or at the same time as accessing the candidate cell that meets the conditions, and derive K SN wait.

[0273] Step 680: The terminal device sends an RRC reconfiguration complete message 3 to the MN. This RRC reconfiguration complete message 3 includes a reconfiguration complete message sent to candidate SN 2. As an example, if the terminal device detects that candidate cell 5 meets the execution condition, the terminal device may send an RRC reconfiguration complete message 3 to the MN. This RRC reconfiguration complete message 3 may include an SN reconfiguration complete message sent to candidate SN 2 (the candidate SN where candidate cell 5 is located). This RRC reconfiguration complete message 3 may indicate that the terminal device selected candidate cell 5.

[0274] It should be understood that the RRC reconfiguration complete message 3 may correspond to the first message mentioned above.

[0275] Optionally, the RRC reconfiguration completion message 3 may further include SN Counter2.

[0276] As an example, if the RRC reconfiguration complete message 3 includes SN Counter2, then in the embodiment of the present application, step 675 should be executed first and then step 680.

[0277] As another example, if RRC Reconfiguration Complete Message 3 does not include SN Counter 2, then the present embodiment does not specifically limit the order of executing Step 675 and Step 680. Step 675 may be executed first, followed by Step 680; or Step 680 may be executed first, followed by Step 675; or Step 675 and Step 680 may be executed simultaneously.

[0278] Step 685: The MN forwards the SN reconfiguration completion message to the candidate SN2.

[0279] In an embodiment of the present application, after receiving the RRC reconfiguration completion message 3 sent by the terminal device, the MN can select the candidate cell as candidate cell 5 according to the candidate cell selected by the terminal device indicated in the message, and forward the SN reconfiguration completion message to the candidate SN2 to which the candidate cell 5 belongs.

[0280] As an example, the MN can obtain SN Counter2 and calculate the value of K gNB And SN Counter2 calculates K SN2 It should be understood that there are multiple implementations for the MN to obtain SN Counter2, which is not specifically limited in the embodiments of the present application. In one possible implementation, the MN obtains SN Counter2 from the reconfiguration completion message 3 sent by the terminal device. In another possible implementation, the MN can update SN Counter1 to obtain SN Counter2 based on the SN Counter update rule of SN Counter+N, where SN Counter2 is SN Counter1+N.

[0281] In the embodiment of the present application, the SN reconfiguration completion message forwarded by the MN to the candidate SN2 to which the candidate cell 5 belongs may also include K SN2 Or MN sends SN2's SN reconfiguration completion message and K SN2 .

[0282] Step 687: MN derives K based on the updated SN Counter SN3 .

[0283] Optionally, the MN can also update SN Counter2 according to the SN Counter update rule to obtain SN Counter3, and use SN Counter3 to derive K SN3 For example, in one possible implementation, the SN Counter update rule is to update the SN Counter to SN Counter+N, where N is a positive integer greater than or equal to 1, or N is the maximum number of candidate cells added or changed for the conditional cell. Based on the SN Counter update rule, the terminal device can obtain SN Counter3 by performing SN Counter2+N, and derive K based on SN Counter3. SN3 .

[0284] Step 688: MN sends the K SN3 .

[0285] MN can use the K derived in step 687 for the next triggered CPC process. SN3Sent to all candidate cells or candidate SNs to which all candidate cells belong.

[0286] In the above technical solution, after executing a CPA or CPC, the MN can use the key K SN3 Send it to all candidate SNs in advance so that the candidate SNs can obtain the key K in advance during the next CPC process. SN3 , and secure communication with the terminal device is not possible only after receiving the reconfiguration completion message of the MN.

[0287] Step 690: The terminal device performs synchronization with the candidate SN2.

[0288] The terminal device can perform synchronization to the candidate SN2 where the candidate cell 5 is located. As an example, the synchronization process can be implemented through RACH. The candidate SN2 can also be based on the received K SN2 Derive the user plane key for encrypting data or protecting data integrity between the terminal device, and also can be based on K SN2 Derive the control plane key for encrypting the signaling between the terminal device or protecting the data integrity. SN2 derives the above user plane or control plane key after receiving the K from the MN. SN2 Afterwards, it may also occur after step 690 or when step 690 is executed.

[0289] It should be noted that the implementation of this application does not specifically limit the execution order of step 687, step 688 and step 690. Step 687 and step 688 can be executed first, and then step 690; or step 690 can be executed first, and then step 687 and step 688; or step 687, step 688 and step 690 can be executed simultaneously.

[0290] Step 692: The terminal device continues to evaluate whether the candidate cells included in the CPAC configuration meet the execution conditions.

[0291] After completing CPC, the terminal device does not release the CPAC configuration. To support subsequent CPC processes, the terminal device retains the CPAC configuration and continues to evaluate candidate cells that meet the execution conditions based on this configuration. The terminal device can update or release the CPAC configuration based on a timer or number of CPA or CPC executions, or based on instructions from the network device.

[0292] Step 694: The terminal device derives K based on the updated SN Counter SN3 .

[0293] Similar to step 675, for the sake of ease of description, only one implementation method is introduced below. For the remaining implementation methods, please refer to the description in step 675 and will not be repeated here.

[0294] If the terminal device evaluates a candidate cell that meets the execution conditions, the terminal device can update the SN Counter based on the last used SN Counter and use the updated SN Counter to derive a new K SN As an example, assuming that the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 1, the terminal device can update SN Counter2 according to the SN Counter update rule to obtain SN Counter3. For example, taking the SN Counter update rule as SN Counter+N, the terminal device can obtain SN Counter3 based on SN Counter2+N based on the SN Counter update rule. The terminal device can also use SN Counter3 to derive K SN3 .

[0295] The terminal device can save K SN3 , and can also be based on K SN3 Derive the user plane key for encrypting data or protecting data integrity between the candidate cell 1, and also can be based on K SN3 A control plane key for encrypting signaling or protecting data integrity with the candidate cell 1 is derived.

[0296] It should be understood that at this time, SN Counter2 may correspond to the second parameter value mentioned above, that is, the parameter value used by the terminal device last time. SN Counter3 may correspond to the first parameter value mentioned above, K SN3 The user plane key and / or control plane key may correspond to the third key mentioned above.

[0297] Step 695: The terminal device sends an RRC reconfiguration complete message 4 to the MN. The RRC reconfiguration complete message 4 includes a reconfiguration complete message sent to the candidate SN1.

[0298] As an example, if the terminal device detects that candidate cell 1 meets the execution condition, the terminal device may send an RRC reconfiguration complete message 4 to the MN. The RRC reconfiguration complete message 4 includes an SN reconfiguration complete message sent to candidate SN1 (the candidate SN where candidate cell 1 is located). The RRC reconfiguration complete message 4 may indicate that the terminal device has selected candidate cell 1.

[0299] It should be understood that the RRC reconfiguration complete message 4 may correspond to the first message mentioned above.

[0300] Optionally, the RRC reconfiguration completion message 4 may further include SN Counter3.

[0301] As an example, if the RRC reconfiguration complete message 4 includes SN Counter3, then in the embodiment of the present application, step 675 should be executed first and then step 680.

[0302] As another example, if RRC Reconfiguration Complete Message 4 does not include SN Counter 3, then the present embodiment does not specifically limit the order of executing Step 694 and Step 695. Step 694 may be executed first, followed by Step 695; or Step 695 may be executed first, followed by Step 694; or Step 694 and Step 695 may be executed simultaneously.

[0303] Step 696: The MN forwards the SN reconfiguration completion message to the candidate SN1.

[0304] In an embodiment of the present application, after receiving the RRC reconfiguration completion message 4 sent by the terminal device, the MN can select the candidate cell as candidate cell 1 according to the terminal device indicated in the message, and forward the SN reconfiguration completion message to the candidate SN1 to which the candidate cell 1 belongs.

[0305] As an example, the MN can obtain SN Counter3 and calculate the value of K gNB And SN Counter3 calculates K SN3 It should be understood that there are multiple implementations for the MN to obtain SN Counter3, which is not specifically limited in the embodiments of the present application. In one possible implementation, the MN obtains SN Counter3 from the reconfiguration completion message 4 sent by the terminal device. In another possible implementation, the MN can update SN Counter2 to obtain SN Counter3 based on the SN Counter update rule of SN Counter+N, where SN Counter3 is SN Counter2+N.

[0306] In the embodiment of the present application, the SN reconfiguration completion message forwarded by the MN to the candidate SN1 to which the candidate cell 1 belongs may also include K SN3 .

[0307] Step 697: MN derives K based on the updated SN Counter SN4 .

[0308] Optionally, the MN can also update SN Counter3 according to the SN Counter update rule to obtain SN Counter4, and use SN Counter4 to derive K SN4For example, in one possible implementation, the SN Counter update rule is to update the SN Counter to SN Counter+N, where N is a positive integer greater than or equal to 1, or N is the maximum number of candidate cells added or changed in the conditional cell. Based on the SN Counter update rule, the terminal device can obtain SN Counter4 by performing SN Counter3+N, and derive K based on SN Counter4. SN4 .

[0309] Step 698: MN sends the K SN4 .

[0310] After executing a CPA or CPC, the MN can use the key K used in the next triggered CPC process. SN4 Send it to all candidate SNs in advance so that the candidate SNs can obtain the key K in advance during the next CPC process. SN4 , and secure communication with the terminal device is not possible only after receiving the reconfiguration completion message of the MN.

[0311] Step 699: The terminal device performs synchronization with the candidate SN1.

[0312] The terminal device can synchronize to the candidate SN1 where the candidate cell 1 is located. As an example, the synchronization process can be implemented through RACH. The candidate SN1 can also be based on the received K SN3 Derive the user plane key for encrypting data or protecting data integrity between the terminal device, and also can be based on K SN3 Derive the control plane key for encrypting the signaling between the terminal device or protecting the data integrity. SN1 derives the above user plane or control plane key after receiving the K from the MN. SN3 Afterwards, it may also occur after step 699 or when step 699 is executed.

[0313] It should be noted that the implementation of this application does not specifically limit the execution order of step 697, step 698 and step 699. Step 697 and step 698 can be executed first, and then step 699; or step 699 can be executed first, and then step 697 and step 698; or step 697, step 698 and step 699 can be executed simultaneously.

[0314] In the above technical solution, the terminal device maintains the SN Counter in the subsequent CPAC process and performs the SN Counter update synchronously with the MN. By updating the SN Counter in each subsequent CPC process, it is ensured that a new K is derived in the candidate CPAC process.SN , avoiding the problem of key reuse.

[0315] Below in conjunction with Figure 7, another specific implementation process of updating the first parameter value in step 510 is described in detail. It should be understood that the example of Figure 7 is only to help those skilled in the art understand the embodiment of the present application, rather than to limit the application embodiment to the specific numerical value or specific scenario illustrated. Those skilled in the art can obviously make various equivalent modifications or changes based on the following example given in Figure 7, and such modifications and changes also fall within the scope of the embodiment of the present application. The description of some steps in Figure 7 is the same as that in Figure 6 and will not be repeated here.

[0316] Figure 7 is a schematic flow chart of another communication method provided by an embodiment of the present application. As shown in Figure 7, the method may include steps 710-795, and steps 710-795 are described in detail below.

[0317] Step 710: The terminal device establishes an RRC connection with the MN.

[0318] Step 715: The terminal device establishes an RRC connection with the source SN.

[0319] It should be noted that step 715 is optional.

[0320] Step 720: The MN sends an SN add request message to the candidate SN1.

[0321] In a possible implementation, the number of SN add request messages sent by the MN to the candidate SN is the same as the number of candidate cells included in the candidate SN. That is, the number of SN add request messages sent by the MN to the candidate SN1 is the same as the number of candidate cells included in the candidate SN1. Each SN add request message may include the K corresponding to the corresponding candidate cell. SN The K SN It is calculated by the MN based on the SN Counter (which can be called the starting SN Counter) corresponding to each candidate cell. Optionally, the MN derives K SN The input also includes the master key.

[0322] In a possible implementation, the SN add request message sent by the MN to the candidate SN includes multiple K SN , corresponding to the multiple candidate cells under the candidate SN. That is, how many candidate cells are included under candidate SN1, and how many K cells are included in the SN add request sent by MN to SN. SN Multiple K SN It is calculated by the MN based on the SN Counter (which can be called the starting SN Counter) corresponding to each candidate cell. Optionally, the MN derives K SNThe input also includes the master key.

[0323] For the above two implementation methods, let's take an example to illustrate that the K corresponding to candidate cell 1 is SN 1 can be calculated by the MN based on the SN Counter corresponding to candidate cell 1; K corresponding to candidate cell 2 SN 2 can be calculated by the MN based on the SN Counter corresponding to candidate cell 2; K corresponding to candidate cell 5 SN 5 can be calculated by the MN according to the SN Counter corresponding to the candidate cell 5, and so on.

[0324] In another possible implementation, the SN add request message sent by the MN to the candidate SN includes a K SN , corresponding to one or more candidate cells under the candidate SN. That is, K corresponding to multiple candidate cells under SN1 SN The K SN It is calculated by the MN based on the SN Counter corresponding to the candidate SN (which can be called the starting SN Counter). Optionally, the MN derives K SN The input also includes the master key.

[0325] For example, the K corresponding to candidate SN1 SN 1 can be calculated by MN based on the SN Counter corresponding to candidate SN1, and is applicable to one or more candidate cells under candidate SN1; K corresponding to candidate SN2 SN 2 can be calculated by the MN according to the SN Counter corresponding to the candidate SN2, and is applicable to one or more candidate cells under the candidate SN2, and so on.

[0326] It should be understood that, taking candidate cell 1 as the first cell above as an example, the SN Counter corresponding to candidate cell 1 corresponds to the third parameter value above, or the SN Counter corresponding to candidate SN1 to which candidate cell 1 belongs corresponds to the third parameter value above.

[0327] The embodiment of the present application does not specifically limit the starting SN Counter corresponding to each candidate cell or each candidate SN. Two possible implementation methods are listed below.

[0328] In one example, the starting SN Counter corresponding to each candidate cell can be the starting value of the SN Counter of each candidate cell (SN Counter#x). For example, the starting value of the SN Counter of candidate cell 1 is SN Counter#1. For another example, the starting value of the SN Counter of candidate cell 2 is SN Counter#2. For another example, the starting value of the SN Counter of candidate cell 3 is SN Counter#3, and so on. In this implementation, the MN can calculate the starting K value corresponding to each candidate cell based on the starting value (SN Counter#x) of the SN Counter corresponding to each candidate cell under candidate SN1 based on the above method. SN .

[0329] In another example, the starting SN Counter corresponding to each candidate cell can be the first SN Counter in the SN Counter value set of each candidate cell. For example, the value set of the SN Counter available to candidate cell 1 is 1 to 10, and the first SN Counter in the value set is 1. For another example, the value set of the SN Counter available to candidate cell 2 is 11 to 20, and the first SN Counter in the value set is 11. In this implementation, the MN can calculate the starting K counter corresponding to each candidate cell based on the above method according to the first SN Counter in the SN Counter value set corresponding to each candidate cell under candidate SN1. SN .

[0330] In another example, the starting SN Counter corresponding to each candidate SN can be the starting value of the SN Counter of each candidate SN (SN Counter#y). For example, the starting value of the SN Counter of candidate SN1 is SN Counter#1. For another example, the starting value of the SN Counter of candidate SN2 is SN Counter#2. For another example, the starting value of the SN Counter of candidate SN3 is SN Counter#3, and so on. In this implementation, the MN can calculate the starting K value of candidate SN1 based on the starting value of the SN Counter corresponding to candidate SN1 (SN Counter#x) based on the above method. SN .

[0331] In another example, the starting SN Counter corresponding to each candidate SN can be the first SN Counter in the SN Counter value set of each candidate SN. For example, the value set of the SN Counter available to candidate SN1 is 1 to 10, and the first SN Counter in the value set is 1. For another example, the value set of the SN Counter available to candidate SN2 is 11 to 20, and the first SN Counter in the value set is 11. In this implementation, the MN can calculate the starting K counter corresponding to candidate SN1 based on the first SN Counter in the SN Counter value set corresponding to candidate SN1 based on the above method. SN .

[0332] Step 725: Candidate SN1 sends an SN add request confirmation message to the MN.

[0333] Step 730: The MN sends an SN add request message to the candidate SN2.

[0334] In a possible implementation, the SN add request message sent by the MN to the candidate SN2 includes the K corresponding to each candidate cell under the candidate SN2. SN The K SN The MN calculates the starting SN Counter based on each candidate cell included in the candidate SN2. For the specific process, please refer to the description in step 720, which will not be repeated here.

[0335] In another possible implementation, the SN add request message sent by the MN to the candidate SN2 includes the K corresponding to the candidate SN2. SN The K SN The MN calculates the starting SN Counter corresponding to the candidate SN 2. For the specific process, please refer to the description in step 720 and will not be repeated here.

[0336] Step 735: The candidate SN2 sends an SN adding request confirmation message to the MN.

[0337] Step 740: The MN sends an RRC reconfiguration message to the terminal device.

[0338] In a possible implementation, the RRC reconfiguration message sent by the MN to the terminal device may include a CPAC configuration, and the CPAC configuration may include the configuration of each candidate cell and the corresponding execution conditions, as well as the SN Counter corresponding to each candidate cell.

[0339] Example 1: The SN Counter corresponding to each candidate cell is the starting value SN Counter#x of the SN Counter of each candidate cell. Optionally, the CPAC configuration may further indicate M, where M is a positive integer (eg, M is a positive integer greater than or equal to the number of candidate cells).

[0340] In Example 2, the SN Counter corresponding to each candidate cell is the starting value SN Counter#x of each candidate cell. The CPAC configuration may also include the number P of available SN Counters for each candidate cell. In other words, the range of available SN Counter values ​​for each candidate cell is SN Counter#x to SN Counter#x+P.

[0341] In Example 3, the SN Counter corresponding to each candidate cell is a value set of the SN Counter available for each candidate cell. For example, the value set 1 of the SN Counter available for candidate cell 1 is 1 to 10, the value set 2 of the SN Counter available for candidate cell 2 is 11 to 20, the value set 3 of the SN Counter available for candidate cell 3 is 21 to 30, and so on.

[0342] In another possible implementation, the RRC reconfiguration message sent by the MN to the terminal device may include a CPAC configuration, which may include the configuration of each candidate cell and the corresponding execution conditions, as well as the SN Counter corresponding to each candidate cell. Multiple candidate cells belonging to the same SN have the same SN Counter. That is, the RRC reconfiguration message sent by the MN to the terminal device may include a CPAC configuration, which may include the configuration of each candidate cell and the corresponding execution conditions, as well as the SN Counter corresponding to each candidate SN.

[0343] Example 4: The SN Counter corresponding to each candidate SN is the starting value SN Counter#y of each candidate SN. Optionally, the CPAC configuration may further indicate Q, where Q is a positive integer (eg, Q is a positive integer greater than or equal to the number of candidate SNs).

[0344] In Example 5, the SN Counter corresponding to each candidate SN is the starting value of the SN Counter for each candidate SN, SN Counter#x. The CPAC configuration may also include the number of available SN Counters for each candidate SN, R. In other words, the range of available SN Counters for each candidate SN is SN Counter#y to SN Counter#y+R.

[0345] In Example 6, the SN Counter corresponding to each candidate SN is a value set of the SN Counter available for each candidate SN. For example, the value set 1 of the SN Counter available for candidate SN1 is 1 to 10, the value set 2 of the SN Counter available for candidate SN2 is 11 to 20, the value set 3 of the SN Counter available for candidate SN3 is 21 to 30, and so on.

[0346] Step 745: The terminal device replies to the MN with an RRC reconfiguration completion message.

[0347] Step 750: The terminal device evaluates whether the candidate PSCell included in the CPAC configuration meets the execution condition.

[0348] Step 755: The terminal device sends an RRC reconfiguration complete message to the MN. The RRC reconfiguration complete message includes an SN reconfiguration complete message sent to the candidate SNs that meet the execution conditions.

[0349] As an example, assuming that the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 1, the terminal device can send an RRC reconfiguration complete message to the MN, and the RRC reconfiguration complete message includes an SN reconfiguration complete message sent to candidate SN1 (the candidate SN where candidate cell 1 is located). The RRC reconfiguration complete message can indicate that the terminal device has selected candidate cell 1.

[0350] Step 758: The MN forwards the SN reconfiguration completion message to the candidate SN1.

[0351] Step 760: The terminal device determines K according to the SN Counter included in the CPAC configuration. SN -1.

[0352] If the terminal device evaluates a candidate cell that meets the conditions, or the terminal device accesses a candidate cell that meets the conditions, the terminal device updates the SN Counter corresponding to the candidate cell or the candidate SN to which the candidate cell belongs, and uses the updated SN Counter to determine K SNFor example, when the terminal device detects that the candidate cell that meets the execution condition is candidate cell 1, it can use the candidate cell 1 or the SN Counter corresponding to the SN to which the candidate cell 1 belongs to derive K SN -1.

[0353] Example 1: If the terminal device evaluates a candidate cell that meets the execution conditions, or accesses a candidate cell that meets the execution conditions, the terminal device updates the SN Counter based on the starting SN Counter corresponding to the candidate cell, or updates the SN Counter based on the SN Counter last used in the candidate cell, or updates the SN Counter based on the SN Counter last used in the cell set where the candidate cell that meets the execution conditions is located, or updates the SN Counter based on the SN Counter last used in a cell that is configured with the same SN Counter as the candidate cell that meets the execution conditions, and uses the updated SN Counter to determine K SN For example, the CPAC configuration includes the starting value of the SN Counter corresponding to the candidate cell x (SN Counter#x), and the SN Counter of the selected cell is updated to SN Counter = SN Counter#x + n*M. Among them, SN Counter#x is the starting value of the SN Counter corresponding to each candidate cell, and n is the same as the K value derived for the candidate cell. SN or n is related to the number of times the terminal device accesses the candidate cell (for example, n is the number of times K is derived for the candidate cell). SN The number of times - 1 or n is the number of times the terminal device accesses the candidate cell - 1, n is an integer greater than or equal to 0), and M is a positive integer (for example, M is an integer greater than or equal to the number of candidate cells). In this implementation, since the terminal device is accessing candidate cell 1 for the first time, K is derived for candidate cell 1. SNThe number of times is 0 (n=0), and the starting SN Counter corresponding to the candidate cell 1 determined by the terminal device according to the above SN Counter update rule is SN Counter#1. For another example, the CPAC configuration includes the starting value of the SN Counter corresponding to the candidate cell x (SN Counter#x), and the SN Counter of the selected candidate cell is updated to SN Counter+M. That is, each time a candidate cell is accessed, the SN Counter is obtained based on the SN Counter+M used last time in the candidate cell. The SN Counter used by the terminal device when accessing the candidate cell for the first time is the starting value of the SN Counter of the candidate cell. In this implementation, since the terminal device is accessing the candidate cell 1 for the first time, the SN Counter used is the starting SN Counter#1. The terminal device can use SN Counter#1 to calculate K SN -1. M can be network configured or predefined.

[0354] Example 2: If the terminal device evaluates a candidate cell that meets the execution conditions, or accesses a candidate cell that meets the execution conditions, the terminal device updates the SN Counter based on the starting SN Counter corresponding to the candidate cell and (optionally) the number of times it accesses the candidate cell, or the terminal device updates the SN Counter based on the SN Counter last used on the candidate SN, and uses the updated SN Counter to determine K SN For example, the CPAC configuration includes the starting value of the SN Counter corresponding to the candidate cell x (SN Counter#x) and (optionally) the number of available SN Counters P for each candidate cell. The SN Counter of the selected cell is updated to SN Counter = SN Counter#x + p, where p is equal to the number of times the terminal device accesses the candidate cell or the K derived for the candidate cell. SN The number of times the terminal device accesses the candidate cell is related (for example, p is the number of times the terminal device accesses the candidate cell - 1, or p is the number of times the terminal device accesses the candidate cell SNThe number of times - 1). In this implementation, the terminal device determines that the starting SN Counter corresponding to candidate cell 1 is SN Counter#1 according to the above-mentioned update rule. For another example, the CPAC configuration includes the starting value of the SN Counter corresponding to candidate cell x (SN Counter#x) and (optionally) the number of available SN Counters P for each candidate cell. The SN Counter of the selected candidate cell is updated to SN Counter=SN Counter+1, that is, each time a candidate cell is accessed, the SN Counter is obtained based on the SN Counter+1 used last time in the candidate cell. The SN Counter used by the terminal device for the first access to the candidate cell is the starting value of the SN Counter of the candidate cell. In this implementation, the number of times a terminal device accesses a candidate cell is limited, that is, a maximum of P times. The P value corresponding to each candidate cell can be the same or different. When the number of terminal device accesses reaches P times, the terminal device can release the configuration of the candidate cell or release the CPAC configuration. It can be understood that one special implementation of this implementation is: when the terminal device accesses a candidate cell, the CPAC configuration of the candidate cell is released, that is, the case where P=1. In this example, since the terminal device is accessing candidate cell 1 for the first time, the SN Counter used is the starting SN Counter#1. The terminal device can use SN Counter#1 to calculate K SN -1. P can be network configured or predefined.

[0355] Example 3: If the terminal device evaluates a candidate cell that meets the execution conditions, or accesses a candidate cell that meets the execution conditions, the terminal device updates the SN Counter based on the multiple SN Counters corresponding to the candidate cell and (optionally) the number of times it accesses the candidate cell, and uses the updated SN Counter to determine K SN . For example, the CPAC configuration includes an SN Counter value set x corresponding to the candidate cell x, and the SN Counter value set x includes multiple available SN Counters corresponding to the candidate cell x. The SN Counter of the selected candidate cell is updated to obtain the corresponding SN Counter from the SN Counter value set according to the number of times the terminal device accesses the candidate cell. In this implementation, since the terminal device accesses the candidate cell 1 for the first time, the terminal device updates the SN Counter to the first SN Counter in the SN Counter value set 1 corresponding to the candidate cell 1. The terminal device can use the first SN Counter in the SN Counter value set to calculate K SN -1.

[0356] Example 4: If the terminal device evaluates a candidate cell that meets the execution conditions, or accesses a candidate cell that meets the execution conditions, the terminal device updates the SN Counter based on the starting SN Counter corresponding to the candidate SN to which the candidate cell belongs, or the terminal device updates the SN Counter based on the SN Counter last used for the candidate SN, and uses the updated SN Counter to determine K SN For example, the CPAC configuration includes the starting value of the SN Counter corresponding to the candidate SNy (SN Counter#y), and the SN Counter of the selected cell is updated to SN Counter=SN Counter#y+n*Q. Among them, SN Counter#y is the starting value of the SN Counter corresponding to each candidate SN, and n is the same as the K derived for the candidate SN. SN or n is related to the number of times the terminal device accesses the candidate SN (for example, K is derived for the candidate SN). SN or n is the number of times the terminal device accesses the candidate SN, n is an integer greater than or equal to 0), Q is a positive integer (for example, Q is an integer greater than or equal to the number of candidate SNs). In this implementation, since the terminal device accesses the candidate SN1 for the first time, K is derived for the candidate SN1. SN The number of times is 0 (n=0), and the terminal device determines that the starting SN Counter corresponding to the SN1 to which the candidate cell 1 belongs according to the above-mentioned SN Counter update rule is SN Counter#1. For another example, the CPAC configuration includes the starting value of the SN Counter corresponding to the candidate SNy (SN Counter#y), and the SN Counter of the selected candidate cell is updated to SN Counter+Q. That is, each time a candidate cell is accessed, the SN Counter is obtained based on the SN Counter+Q used last time in the SN to which the candidate cell belongs. The SN Counter used by the terminal device for the first time to access the candidate SN is the starting value of the SN Counter of the candidate SN. In this implementation, since the terminal device is accessing the candidate SN1 to which the candidate cell 1 belongs for the first time, the SN Counter used is the starting SN Counter#1 corresponding to the candidate SN1. The terminal device can use SN Counter#1 to calculate K SN -1. Q can be network configured or predefined.

[0357] Example 5: If the terminal device evaluates a candidate cell that meets the execution conditions, or accesses a candidate cell that meets the execution conditions, the terminal device updates the SN Counter based on the starting SN Counter corresponding to the candidate SN to which the candidate cell belongs and (optionally) the number of times the candidate SN has been accessed, or the terminal device updates the SN Counter based on the SN Counter last used for the candidate SN, and uses the updated SN Counter to determine K SN For example, the CPAC configuration includes the starting value of the SN Counter corresponding to the candidate SNy (SN Counter#y) and the number of available SN Counters R for each candidate SN. The SN Counter of the selected candidate cell is updated to SN Counter=SN Counter#y+r, where r is equal to the number of times the terminal device accesses the candidate SN or the number K derived for the candidate SN. SN The number of times the terminal device accesses the candidate SN is related (for example, r is the number of times the terminal device accesses the candidate SN - 1, or r is the number of times the terminal device accesses the candidate SN SN Number of times - 1). In this implementation, the terminal device determines the starting SN Counter corresponding to SN1 to which candidate cell 1 belongs as SN Counter#1 according to the above-mentioned update rule. For another example, the CPAC configuration includes the starting value of the SN Counter corresponding to candidate SNy (SN Counter#y) and (optionally) the number of available SN Counters R for each candidate cell. The SN Counter of the selected candidate cell is updated to SN Counter = SN Counter + 1, that is, each time a candidate cell is accessed, the SN Counter is obtained based on the SN Counter + 1 used last time for the SN to which the candidate cell belongs. The SN Counter used by the terminal device for the first access to the candidate SN is the starting value of the SN Counter of the candidate SN. In this implementation, the number of times a terminal device can access a candidate SN is limited, that is, a maximum of R times. The R value corresponding to each candidate cell can be the same or different. When the terminal device accesses a candidate SN the number of times reaches R, the terminal device can release the configuration of the candidate cell under the candidate SN or release the CPAC configuration. It can be understood that one special implementation of this implementation is that when the terminal device accesses a candidate cell, the CPAC configuration of the SN to which the candidate cell belongs is released, that is, the case where R = 1. In this example, since the terminal device is accessing SN1 to candidate cell 1 for the first time, the SN Counter used is the starting SN Counter#1. The terminal device can use SN Counter#1 to calculate K SN -1. R can be network configured or predefined.

[0358] Example 6: If the terminal device evaluates a candidate cell that meets the execution conditions, or accesses a candidate cell that meets the execution conditions, the terminal device updates the SN Counter based on the multiple SN Counters corresponding to the SN to which the candidate cell belongs and (optionally) the number of times the candidate SN has been accessed, and uses the updated SN Counter to determine K SN . For example, the CPAC configuration includes an SN Counter value set y corresponding to the candidate SNy, and the SN Counter value set y includes multiple available SN Counters corresponding to the candidate SNy. The SN Counter of the selected candidate cell is updated to obtain the corresponding SN Counter from the SN Counter value set according to the number of times the terminal device accesses the candidate SN. In this implementation, since the terminal device accesses the candidate SN1 belonging to the candidate cell 1 for the first time, the terminal device updates the SN Counter to the first SN Counter in the SN Counter value set 1 corresponding to the candidate SN1. The terminal device can use the first SN Counter in the SN Counter value set to calculate K SN -1.

[0359] Example 7: If the terminal device evaluates a candidate cell that meets the execution conditions, or accesses a candidate cell that meets the execution conditions, the terminal device updates the SN Counter based on the multiple SN Counters associated with the cell set to which the candidate cell belongs, and uses the updated SN Counter to determine K SN For example, the CPAC configuration includes a set of SN Counter values ​​associated with the cell set to which the candidate SNz belongs as a value set z, and the value set z of the SN Counter includes multiple available SN Counters. In one example, an SN Counter can be randomly selected from the value set z of the SN Counter, and K can be calculated based on the selected SN Counter. SN -1. In another example, according to the sizes of multiple available SN Counters in the SN Counter value set z, select SN Counters in descending order or descending order, and calculate K based on the selected SN Counter. SN-1. In another example, the SN Counter of the selected candidate cell is updated to obtain the corresponding SN Counter from the SN Counter value set z according to the number of times the terminal device accesses the candidate SN. In this implementation, since the terminal device is accessing the candidate SN1 belonging to the candidate cell 1 for the first time, the terminal device updates the SN Counter to the first SN Counter in the SN Counter value set z. The terminal device can use the first SN Counter in the SN Counter value set z to calculate K SN -1.

[0360] The terminal device can save K SN -1, can also be based on K SN -1 derives a user plane key for encrypting data between the candidate cell 1 or protecting data integrity, and can also be based on K SN -1 derives a control plane key for encrypting signaling or protecting data integrity with the candidate cell 1.

[0361] Step 763: The MN derives the K used in the next triggered CPC process based on the updated SN Counter. SN .

[0362] Optionally, in some embodiments, the MN may also derive a new key for all candidate SNs (e.g., candidate SN1, candidate SN2) or all candidate cells (e.g., candidate cell 1 to candidate cell 9) after each execution of CPA or CPC. The new key is used for the next triggered CPC process.

[0363] As an example, take each candidate cell as having an SN Counter. The MN can update the starting SN Counter corresponding to each candidate cell to obtain the updated SN Counter corresponding to each candidate cell, and derive the K counter corresponding to each candidate cell based on the updated SN Counter corresponding to each candidate cell. SN If the terminal device accesses a candidate cell during the next CPC process, the candidate cell can use the K SN For example, taking candidate cell 1 as an example, the starting SN Counter of candidate cell 1 is updated, and the updated SN Counter of candidate cell 1 is used to derive the K value used by candidate cell 1 in the next CPC process. SN (For example, K SN-1-1). For another example, taking candidate cell 5 as an example, the starting SN Counter of candidate cell 5 is updated, and the updated SN Counter of candidate cell 5 is used to derive the K counter used by candidate cell 5 in the next CPC process. SN (For example, K SN -5-1). Please refer to the description of step 760 for the specific process, which will not be described in detail here.

[0364] Another example is to take each candidate SN as an example. The MN can update the SN Counter corresponding to each candidate SN to obtain the updated SN Counter corresponding to each candidate SN, and derive the K corresponding to each candidate SN based on the updated SN Counter corresponding to each candidate SN. SN If the terminal device accesses a candidate cell during the next CPC process, the candidate cell can use the K corresponding to the SN to which the candidate cell belongs. SN The specific process is described in step 760 and will not be described in detail here.

[0365] Step 764: The MN sends the corresponding K to the candidate cell or the candidate SN to which the candidate cell belongs. SN .

[0366] MN can use the K derived in step 763 for the next triggered CPC process SN Sent to all candidate cells or candidate SNs to which all candidate cells belong.

[0367] In the above technical solution, after executing a CPA or CPC, the MN can use the key K SN Send it to all candidate cells or candidate SNs to which the candidate cells belong in advance, so that the candidate cells or candidate SNs to which the candidate cells belong can obtain the key K in advance during the next CPC process. SN , and secure communication with the terminal device is not possible only after receiving the reconfiguration completion message of the MN.

[0368] Step 765: The terminal device performs synchronization with the candidate SN1.

[0369] The terminal device can perform synchronization to the candidate SN1 where the candidate cell 1 is located. As an example, the synchronization process can be implemented through RACH. The candidate cell 1 can also be based on the received K SN -1 derives a user plane key for encrypting data between the terminal device or protecting data integrity, and can also be based on K SN-1 derives a control plane key for encrypting signaling or protecting data integrity with the terminal device.

[0370] It should be noted that the present application does not impose any specific restrictions on the order in which steps 755, 758, 760, and 765 are executed. The terminal device may first execute steps 755 and 758, then execute step 760, and then execute step 765; or, it may first execute step 760, then execute steps 755 and 758, and then execute step 765; or, it may execute steps 755, 758, 760, and 765 simultaneously.

[0371] It should be noted that the implementation of this application does not specifically limit the execution order of step 763, step 764 and step 765. Step 763 and step 764 can be executed first, and then step 765; or step 765 can be executed first, and then step 763 and step 764; or step 763, step 764 and step 765 can be executed simultaneously.

[0372] Step 770: The terminal device continues to evaluate whether the candidate cells included in the CPAC configuration meet the execution conditions.

[0373] Step 775: The terminal device determines K according to the SN Counter included in the CPAC configuration. SN -5.

[0374] If the terminal device evaluates a candidate cell that meets the conditions, or the terminal device subsequently accesses a candidate cell that meets the conditions, the terminal device updates the SN Counter corresponding to the candidate cell or the candidate SN to which the candidate cell belongs, and uses the updated SN Counter to determine K SN For example, when the terminal device detects that the candidate cell that meets the execution condition is candidate cell 5, the terminal device can use the candidate cell 5 or the starting SN Counter corresponding to the SN to which the candidate cell 5 belongs to determine K SN -5.

[0375] Example 1: If the terminal device evaluates a candidate cell that meets the conditions, or the terminal device accesses a candidate cell that meets the conditions, the terminal device updates the SN Counter according to the starting SN Counter corresponding to the candidate cell, or the terminal device updates the SN Counter according to the SN Counter last used in the candidate cell, and uses the updated SN Counter to determine K SNFor example, the CPAC configuration includes the starting value of the SN Counter corresponding to the candidate cell 5 (SN Counter#5), and the SN Counter of the candidate cell 5 is updated to SN Counter#5+n*M. In this implementation, since the terminal device is accessing the candidate cell 5 for the first time, K is derived for the candidate cell 5. SN The number of times is 0 (n=0), and the SN Counter corresponding to the candidate cell 5 determined by the terminal device according to the above SN Counter update rule is SN Counter#5. For another example, the CPAC configuration includes the starting value of the SN Counter corresponding to the candidate cell 5 (SN Counter#5), and the SN Counter of the candidate cell 5 is updated to SN Counter+M. That is, each time a candidate cell is accessed, the SN Counter is obtained based on the SN Counter+M used last time in the candidate cell. In this implementation, since the terminal device is accessing the candidate cell 5 for the first time, the SN Counter used is the starting SN Counter#5. The terminal device can use SN Counter#5 to calculate K SN -5.

[0376] Example 2: If the terminal device evaluates a candidate cell that meets the execution conditions, or accesses a candidate cell that meets the execution conditions, the terminal device updates the SN Counter based on the starting SN Counter corresponding to the candidate cell and (optionally) the number of times it accesses the candidate cell, or the terminal device updates the SN Counter based on the SN Counter last used on the candidate SN, and uses the updated SN Counter to determine K SN For example, the CPAC configuration includes the starting value of the SN Counter corresponding to candidate cell 5 (SN Counter#5). The SN Counter of candidate cell 5 is updated to SN Counter=SN Counter#5+p, where p is equal to the number of times the terminal device accesses the candidate cell 5 or the K value derived for the candidate cell 5. SN The number of times the terminal device accesses the candidate cell 5 is related (for example, p is the number of times the terminal device accesses the candidate cell 5 - 1, or p is the number of times K is derived for the candidate cell 5 SN In this implementation, since the terminal device accesses the candidate cell 5 for the first time, K is derived for the candidate cell 5. SNThe number of times the terminal device accesses the candidate cell 5 is 0 (n=0), and the SN Counter corresponding to the candidate cell 5 determined by the terminal device according to the above update rule is SN Counter#5. For another example, the CPAC configuration includes the starting value (SN Counter#5) of the SN Counter corresponding to the candidate cell 5 and (optionally) the number of available SN Counters P of the candidate cell 5. The SN Counter of the candidate cell 5 is updated to SN Counter=SN Counter+1, that is, each time the candidate cell 5 is accessed, the SN Counter is obtained based on the SN Counter+1 used last time in the candidate cell 5. In this implementation, the number of times the terminal device accesses the candidate cell 5 is limited, that is, a maximum of P times. The P value corresponding to each candidate cell can be the same or different. When the number of terminal device accesses reaches P times, the terminal device can release the configuration of the candidate cell or release the CPAC configuration. It can be understood that one of the special implementations of this implementation is: the terminal device accesses the candidate cell and releases the CPAC configuration of the candidate cell, that is, the case of P=1. In the example, since the terminal device is accessing the candidate cell 5 for the first time, the SN Counter used is the starting SN Counter#5. The terminal device can use SN Counter#5 to calculate K SN -5.

[0377] Example 3: If the terminal device evaluates a candidate cell that meets the execution conditions, or accesses a candidate cell that meets the execution conditions, the terminal device updates the SN Counter based on the multiple SN Counters corresponding to the candidate cell and (optionally) the number of times it accesses the candidate cell, and uses the updated SN Counter to determine K SN For example, the CPAC configuration includes an SN Counter value set 5 corresponding to the candidate cell 5, and the value set 5 includes multiple available SN Counters corresponding to the candidate cell 5. In this implementation, since the terminal device is accessing the candidate cell 5 for the first time, the starting SN Counter corresponding to the candidate cell 5 determined by the terminal device according to the above SN Counter update rule is the first SN Counter in the SN Counter value set 5 of the candidate cell 5. The terminal device can use the first SN Counter to calculate K SN -5.

[0378] Example 4: If the terminal device evaluates a candidate cell that meets the conditions, or the terminal device accesses a candidate cell that meets the conditions, the terminal device updates the SN Counter according to the starting SN Counter corresponding to the candidate SN to which the candidate cell belongs, or the terminal device updates the SN Counter according to the SN Counter last used for the candidate SN, and uses the updated SN Counter to determine K SN For example, the CPAC configuration includes the starting value of the SN Counter (SN Counter#2) corresponding to the SN2 to which the candidate cell 5 belongs, and the SN Counter of the candidate SN to which the candidate cell 5 belongs is updated to SN Counter#2+n*Q. In this implementation, since the terminal device is accessing the SN2 to which the candidate cell 5 belongs for the first time, K is derived for the SN2 to which the candidate cell 5 belongs. SN The number of times is 0 (n=0), and the SN Counter corresponding to SN2 to which the candidate cell 5 belongs is determined by the terminal device according to the above-mentioned SN Counter update rule to be SN Counter#2. For another example, the CPAC configuration includes the starting value (SN Counter#2) of the SN Counter corresponding to SN2 to which the candidate cell 5 belongs, and the SN Counter of SN2 to which the candidate cell 5 belongs is updated to SN Counter+Q. That is, each time a candidate cell is accessed, the SN Counter is obtained based on the SN Counter+Q used last time for the candidate SN to which the candidate cell belongs. The SN Counter used by the terminal device when accessing the candidate SN for the first time is the starting value of the SN Counter of the candidate SN. In this implementation, since the terminal device is accessing SN2 to which the candidate cell 5 belongs for the first time, the SN Counter used is SN Counter#2. The terminal device can use SN Counter2 to calculate K SN -5.

[0379] Example 5: If the terminal device evaluates a candidate cell that meets the execution conditions, or accesses a candidate cell that meets the execution conditions, the terminal device updates the SN Counter based on the starting SN Counter corresponding to the candidate SN to which the candidate cell belongs and (optionally) the number of times the candidate SN has been accessed, or the terminal device updates the SN Counter based on the SN Counter last used on the candidate SN, and uses the updated SN Counter to determine K SNFor example, the CPAC configuration includes the starting value of the SN Counter corresponding to SN2 to which the candidate cell 5 belongs (SN Counter#2). The SN Counter of SN2 to which the candidate cell 5 belongs is updated to SN Counter=SN Counter#2+p, where p is equal to the number of times the terminal device accesses SN2 to which the candidate cell 5 belongs or the K derived for SN2 to which the candidate cell 5 belongs. SN The number of times the terminal device accesses the candidate SN2 is related (for example, p is the number of times the terminal device accesses the candidate SN2 - 1, or p is the number of times the terminal device accesses the candidate SN2 SN In this implementation, since the terminal device is accessing SN2 to which the candidate cell 5 belongs for the first time, K is derived for SN2 to which the candidate cell 5 belongs. SN The number of times is 0 (n=0), and the SN Counter corresponding to the candidate cell 5 determined by the terminal device according to the above update rule is SN Counter#2. For another example, the CPAC configuration includes the starting value (SN Counter#5) of the SN Counter corresponding to SN2 to which the candidate cell 5 belongs and (optionally) the number of available SN Counters P of the candidate cell 5. The SN Counter of SN2 to which the candidate cell 5 belongs is updated to SN Counter=SN Counter+1, that is, each time the candidate cell 5 is accessed, the SN Counter is obtained based on the SN Counter+1 used last time in SN2 to which the candidate cell 5 belongs. In this implementation, the number of times the terminal device accesses SN2 is limited, that is, a maximum of P times. The P value corresponding to each candidate SN can be the same or different. When the number of terminal device accesses reaches P times, the terminal device can release the configuration of the candidate cell under the SN or release the CPAC configuration. In the example, since the terminal device is accessing SN2 to which the candidate cell 5 belongs for the first time, the SN Counter used is SN Counter#2. The terminal device can use SN Counter#2 to calculate K SN -5.

[0380] Example 6: If the terminal device evaluates a candidate cell that meets the execution conditions, or accesses a candidate cell that meets the execution conditions, the terminal device updates the SN Counter based on the multiple SN Counters corresponding to the SN of the candidate cell and (optionally) the number of times the terminal device accesses the candidate cell, and uses the updated SN Counter to determine K SNFor example, the CPAC configuration includes SN Counter value set 2 corresponding to SN2 to which candidate cell 5 belongs, and value set 2 includes multiple available SN Counters corresponding to SN2 to which candidate cell 5 belongs. In this implementation, since the terminal device is accessing SN2 to which candidate cell 5 belongs for the first time, the SN Counter corresponding to SN2 to which candidate cell 5 belongs, determined by the terminal device according to the above SN Counter update rule, is the first SN Counter in SN Counter value set 2 of candidate SN2. The terminal device can use this first SN Counter to calculate K SN -5.

[0381] The terminal device can also be based on K SN -5 derives a user plane key for encrypting data or protecting data integrity between the candidate cell 5 and the candidate cell 5, and can also be based on K SN -5 derives a control plane key for encrypting signaling or protecting data integrity with the candidate cell 5.

[0382] Step 776: The terminal device sends an RRC reconfiguration complete message to the MN, where the RRC reconfiguration complete message includes a reconfiguration complete message sent to the candidate SN2.

[0383] As an example, assuming that the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 5, the terminal device can send an RRC reconfiguration complete message to the MN, and the RRC reconfiguration complete message includes a reconfiguration complete message sent to candidate SN2 (the candidate SN where candidate cell 5 is located). The RRC reconfiguration complete message can indicate that the terminal device has selected candidate cell 5.

[0384] Step 777: The MN forwards the SN reconfiguration completion message to the candidate SN2.

[0385] Similarly, the implementation of this application does not specifically limit the execution order of step 775, step 777 and step 778.

[0386] Step 778: MN derives K used in the next triggered CPC process based on the updated SN Counter. SN .

[0387] In one example, each candidate cell corresponds to an SN Counter. For example, taking candidate cell 1 as an example, the SN Counter used by the terminal device when it last accessed the candidate cell 1 is updated, and the updated SN Counter of the candidate cell 1 is used to derive the K counter used by the candidate cell 1 in the next CPC process. SN (For example, K SN-1-2). For another example, taking candidate cell 5 as an example, the SN Counter used by the terminal device when it last accessed the candidate cell 5 is updated, and the updated SN Counter of the candidate cell 5 is used to derive the K counter used by the candidate cell 5 in the next CPC process. SN (For example, K SN -5-2).

[0388] In another example, each candidate SN corresponds to an SN Counter. For example, taking candidate SN1 as an example, the SN Counter used by the terminal device when it last accessed the candidate SN1 is updated, and the updated SN Counter of the candidate SN1 is used to derive the K counter used by the candidate SN1 in the next CPC process. SN For example, taking candidate SN2 as an example, the SN Counter used by the terminal device when it last accessed the candidate SN2 is updated, and the updated SN Counter of candidate SN2 is used to derive the K used by candidate SN2 in the next CPC process. SN .

[0389] Step 789: MN sends the corresponding K to the candidate cell or the candidate SN to which the candidate cell belongs. SN .

[0390] MN can use the K derived in step 788 for the next triggered CPC process. SN Sent to all candidate cells or candidate SNs to which all candidate cells belong.

[0391] In the above technical solution, after executing a CPA or CPC, the MN can use the key K SN Send it to all candidate cells or candidate SNs to which the candidate cells belong in advance, so that the candidate cells or candidate SNs to which the candidate cells belong can obtain the key K in advance during the next CPC process. SN , and secure communication with the terminal device is not possible only after receiving the reconfiguration completion message of the MN.

[0392] Step 780: The terminal device performs synchronization with the candidate SN2.

[0393] The terminal device may perform synchronization to the candidate SN2 where the candidate cell 5 is located. As an example, the synchronization process may be implemented through RACH.

[0394] Candidate cell 5 can also be based on the received K SN -5 derives a user plane key for encrypting data between the terminal device or protecting data integrity, and can also be based on K SN-5 Deriving a control plane key for encrypting signaling or protecting data integrity with the terminal device.

[0395] It should be noted that the implementation of this application does not specifically limit the execution order of step 778, step 779 and step 780. Step 778 and step 779 can be executed first, and then step 780; or step 780 can be executed first, and then step 778 and step 779; or step 778, step 779 and step 780 can be executed at the same time.

[0396] Step 783: The terminal device continues to evaluate whether the candidate cells included in the CPAC configuration meet the execution conditions.

[0397] Step 788: The terminal device determines and saves K according to the SN Counter included in the CPAC configuration. SN -1-1.

[0398] When the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 1 again, the terminal device can update the starting SN Counter corresponding to the candidate cell 1 or the SN1 to which the candidate cell 1 belongs, obtain the updated SN Counter, and determine and save K based on the updated SN Counter. SN -1-1.

[0399] Example 1: For example, the CPAC configuration includes the starting value of the SN Counter corresponding to the candidate cell 1 (SN Counter#1), and the SN Counter corresponding to the candidate cell 1 is updated to SN Counter#x+n*M. In this implementation, since the terminal device is accessing the candidate cell 1 for the second time, K is derived for the candidate cell 1. SN The number of times is 1 (n=1), the terminal device updates the SN Counter corresponding to candidate cell 1 according to the above SN Counter update rule, and the updated SN Counter is SN Counter#1+1*M. For another example, the CPAC configuration includes the starting value of the SN Counter corresponding to candidate cell 1 (SN Counter#1), and the terminal device updates the SN Counter corresponding to candidate cell 1 to the SN Counter+M last used in candidate cell 1. Since the SN Counter last used by the terminal device in candidate cell 1 is SN Counter#1, the terminal device updates the SN Counter of candidate cell 1 to SN Counter#1+M. The terminal device can use SN Counter#1+1*M ​​to calculate K SN -1-1.

[0400] Example 2, for example, the CPAC configuration includes the SN Counter starting value (SN Counter#1) corresponding to candidate cell 1, and the SN Counter of candidate cell 1 is updated to SN Counter=SN Counter#1+P. In this implementation, since the terminal device is accessing candidate cell 1 for the second time, the terminal device updates the SN Counter corresponding to candidate cell 1 according to the above-mentioned update rules, and the updated SN Counter is SN Counter#1+1. For another example, the SN Counter corresponding to candidate cell 1 included in the CPAC configuration is the SN Counter starting value (SN Counter#1), and the terminal device updates the SN Counter corresponding to candidate cell 1 to the SN Counter+1 last used in candidate cell 1. Since the SN Counter used the last time to access candidate cell 1 was SN Counter#1, the terminal device updates the SN Counter of candidate cell 1 to SN Counter#1+1. The terminal device can use SN Counter#1+1 to calculate K SN -1-1.

[0401] Example 3, the CPAC configuration includes an SN Counter value set 1 corresponding to candidate cell 1, and the SN Counter value set 1 includes multiple available SN Counters corresponding to candidate cell 1. The SN Counter update rule is to determine the corresponding SN Counter from the SN Counter value set based on the number of times the terminal device accesses the candidate cell 1. In this implementation, since the terminal device accesses the candidate cell 1 for the second time, the terminal device updates the starting SN Counter corresponding to the candidate cell 1 according to the above SN Counter update rule, and the updated SN Counter is the second SN Counter in the SN Counter value set corresponding to the candidate cell 1. The terminal device can use the second SN Counter in the SN Counter value set to calculate K SN -1-1.

[0402] Example 4: For example, the CPAC configuration includes the starting value of the SN Counter corresponding to the SN1 to which the candidate cell 1 belongs (SN Counter#1), and the SN Counter corresponding to the SN1 to which the candidate cell 1 belongs is updated to SN Counter#x+n*Q. In this implementation, since the terminal device is accessing the SN1 to which the candidate cell 1 belongs for the second time, K is derived for the SN1 to which the candidate cell 1 belongs. SNThe number of times is 1 (n=1), the terminal device updates the SN Counter corresponding to SN1 to which candidate cell 1 belongs according to the above SN Counter update rule, and the updated SN Counter is SN Counter#1+1*Q. For another example, the CPAC configuration includes the starting value (SN Counter#1) of the SN Counter corresponding to SN1 to which candidate cell 1 belongs, and the terminal device updates the SN Counter corresponding to SN1 to which candidate cell 1 belongs to the SN Counter+Q last used in SN1. Since the SN Counter last used by the terminal device in SN1 to which candidate cell 1 belongs is SN Counter#1, the terminal device updates the SN Counter of SN1 to which candidate cell 1 belongs to SN Counter#1+Q. The terminal device can use SN Counter#1+1*Q to calculate K SN -1-1.

[0403] Example 5, for example, the CPAC configuration includes the SN Counter starting value (SN Counter#1) corresponding to SN1 to which candidate cell 1 belongs. The SN Counter of SN1 to which candidate cell 1 belongs is updated to SN Counter=SN Counter#1+r, where r is equal to the number of times the terminal device accesses the SN1 or K derived for SN1. SN The number of times the terminal device accesses SN1 is related (for example, r is the number of times the terminal device accesses SN1 - 1, or r is the number of times K is derived for SN1 SN The number of times - 1). In this implementation, since the terminal device accesses SN1 to candidate cell 1 for the second time, the terminal device updates the SN Counter corresponding to SN1 to candidate cell 1 according to the above-mentioned update rule, and the updated SN Counter is SN Counter#1+1. For another example, the SN Counter corresponding to SN1 to candidate cell 1 included in the CPAC configuration is the SN Counter starting value (SN Counter#1), and the terminal device updates the SN Counter corresponding to SN1 to candidate cell 1 to the SN Counter+1 last used in SN1 to candidate cell 1. Since the SN Counter used for the last access to SN1 to candidate cell 1 was SN Counter#1, the terminal device updates the SN Counter of SN1 to candidate cell 1 to SN Counter#1+1. The terminal device can use SN Counter#1+1 to calculate K SN -1-1.

[0404] Example 3, the CPAC configuration includes an SN Counter value set 1 corresponding to the SN1 to which the candidate cell 1 belongs, and the SN Counter value set 1 includes multiple available SN Counters corresponding to the SN1 to which the candidate cell 1 belongs. The SN Counter update rule is to determine the corresponding SN Counter from the SN Counter value set based on the number of times the terminal device accesses the SN1 to which the candidate cell 1 belongs. In this implementation, since the terminal device accesses the SN1 to which the candidate cell 1 belongs for the second time, the terminal device updates the starting SN Counter corresponding to the SN1 to which the candidate cell 1 belongs according to the above-mentioned SN Counter update rule, and the updated SN Counter is the second SN Counter in the SN Counter value set corresponding to the SN1 to which the candidate cell 1 belongs. The terminal device can use the second SN Counter in the SN Counter value set to calculate K SN -1-1.

[0405] The terminal device can also be based on K SN -1-1 derives a user plane key for encrypting data between the candidate cell 1 or protecting data integrity, and can also be based on K SN -1-1 derives a control plane key for encrypting signaling or protecting data integrity with the candidate cell 1.

[0406] Step 789: The terminal device sends an RRC reconfiguration complete message to the MN, where the RRC reconfiguration complete message includes a reconfiguration complete message sent to the candidate SN1.

[0407] As an example, assuming that the terminal device again detects that the candidate cell that meets the execution conditions is candidate cell 1, the terminal device can send an RRC reconfiguration complete message to the MN, and the RRC reconfiguration complete message includes a reconfiguration complete message sent to candidate SN1 (the candidate SN where candidate cell 1 is located). The RRC reconfiguration complete message can indicate that the candidate cell selected by the terminal device is candidate cell 1.

[0408] Optionally, the RRC reconfiguration complete message may further include the selected candidate cell or an updated SN Counter corresponding to the SN to which the selected candidate cell belongs.

[0409] As an example, if the RRC reconfiguration completion message includes the updated SN Counter corresponding to candidate cell 1, then in the embodiment of the present application, step 788 should be executed first, and then step 789 should be executed.

[0410] As another example, if the RRC reconfiguration complete message does not include the updated SN Counter, then the present embodiment does not specifically limit the order in which steps 788 and 789 are performed. Step 788 may be performed first, followed by step 789; or step 789 may be performed first, followed by step 788; or both steps 788 and 789 may be performed simultaneously.

[0411] Step 790: The MN forwards the SN reconfiguration completion message to the candidate SN1.

[0412] In an embodiment of the present application, after receiving the RRC reconfiguration completion message sent by the terminal device, the MN can select the candidate cell as candidate cell 1 according to the terminal device indicated in the message, and forward the SN reconfiguration completion message to the candidate SN1 where the candidate cell 1 is located.

[0413] In the embodiment of the present application, the SN reconfiguration completion message forwarded by the MN to the candidate SN1 to which the candidate cell 1 belongs may also include K SN -1-1.

[0414] As an example, the MN may obtain the SN Counter after updating the starting SN Counter of the candidate cell 1 or the SN1 to which the candidate cell 1 belongs, and calculate K according to the updated SN Counter corresponding to the candidate cell 1 or the SN1 to which the candidate cell 1 belongs. SN -1-1. It should be understood that there are many ways for MN to obtain the updated SN Counter corresponding to the candidate cell 1 or the SN1 to which the candidate cell 1 belongs. The embodiments of the present application do not specifically limit this. In one possible implementation method, the reconfiguration completion message sent by the terminal device to the MN includes the updated SN Counter, that is, the MN obtains the updated SN Counter corresponding to the candidate cell 1 or the SN1 to which the candidate cell 1 belongs from the reconfiguration completion message sent by the terminal device. In another possible implementation method, the MN can determine the updated SN Counter corresponding to the candidate cell 1 or the SN1 to which the candidate cell 1 belongs based on the starting SN Counter corresponding to the candidate cell 1 or the SN1 to which the candidate cell 1 belongs and the SN Counter update rules in the above examples 1 to 6. For the specific determination process, please refer to the description in step 788, which will not be repeated here.

[0415] Step 791: MN derives K used in the next triggered CPC process based on the updated SN Counter. SN .

[0416] In one example, each candidate cell corresponds to an SN Counter. For example, taking candidate cell 1 as an example, the SN Counter used by the terminal device when it last accessed the candidate cell 1 is updated, and the updated SN Counter of the candidate cell 1 is used to derive the K counter used by the candidate cell 1 in the next CPC process. SN (For example, K SN -1-3). For another example, taking candidate cell 5 as an example, the SN Counter used by the terminal device when it last accessed the candidate cell 5 is updated, and the updated SN Counter of the candidate cell 5 is used to derive the K counter used by the candidate cell 5 in the next CPC process. SN (For example, K SN -5-3).

[0417] In another example, each candidate SN corresponds to an SN Counter. For example, taking candidate SN1 as an example, the SN Counter used by the terminal device when it last accessed the candidate SN1 is updated, and the updated SN Counter of the candidate SN1 is used to derive the K counter used by the candidate SN1 in the next CPC process. SN For example, taking candidate SN2 as an example, the SN Counter used by the terminal device when it last accessed the candidate SN2 is updated, and the updated SN Counter of candidate SN2 is used to derive the K used by candidate SN2 in the next CPC process. SN .

[0418] Step 792: The MN sends the corresponding K to the candidate cell or the candidate SN to which the candidate cell belongs. SN .

[0419] MN can use the K derived in step 791 for the next triggered CPC process SN Sent to all candidate cells or candidate SNs to which all candidate cells belong.

[0420] In the above technical solution, after executing a CPA or CPC, the MN can use the key K SN Send it to all candidate cells or candidate SNs to which the candidate cells belong in advance, so that the candidate cells or candidate SNs to which the candidate cells belong can obtain the key K in advance during the next CPC process. SN , and secure communication with the terminal device is not possible only after receiving the reconfiguration completion message of the MN.

[0421] Step 795: The terminal device performs synchronization with the candidate SN1.

[0422] The terminal device can perform synchronization to the candidate SN1 where the candidate cell 1 is located. As an example, the synchronization process can be implemented through RACH. The candidate cell 1 can also be based on the received K SN -1-1 derives a user plane key for encrypting data between the terminal device or protecting data integrity, and can also be based on K SN -1-1 derives a control plane key for encrypting signaling or protecting data integrity with the terminal device.

[0423] In the above technical solution, in the subsequent CPAC process, each time the terminal device triggers CPA or CPC, the terminal device updates the SN Counter corresponding to the selected candidate cell or the SN to which the selected candidate cell belongs. The terminal device maintains the SN Counter for each candidate cell or each candidate SN in the subsequent CPAC process and updates the SN Counter, ensuring that when the subsequent CPAC process returns to the previously accessed candidate cell or candidate SN, a new K is derived from the new SN Counter. SN , avoiding the problem of key reuse.

[0424] The following is a detailed description of the specific implementation process of using the P-th value in the first set as the first parameter value in step 510 in conjunction with Figure 8. It should be understood that the example of Figure 8 is only intended to help those skilled in the art understand the embodiments of the present application, and is not intended to limit the embodiments of the application to the specific values ​​or specific scenarios illustrated. It is obvious that those skilled in the art can make various equivalent modifications or changes based on the following example given in Figure 8, and such modifications and changes also fall within the scope of the embodiments of the present application.

[0425] FIG8 is a schematic flow chart of another communication method provided by an embodiment of the present application. As shown in FIG8, the method may include steps 810-899, and steps 810-899 are described in detail below. The description of some steps in FIG8 is the same as that in FIG6 or FIG7, and will not be repeated here.

[0426] Step 810: The terminal device establishes an RRC connection with the MN.

[0427] Step 815: The terminal device establishes an RRC connection with the source SN.

[0428] It should be noted that step 815 is optional.

[0429] Step 820: The MN sends an SN add request message to the candidate SN.

[0430] As an example, the MN sends SN adding request messages to the candidate SN1 and the candidate SN2 respectively.

[0431] In a possible implementation, the SN add request message may include a set of K corresponding to each candidate cell. SN The group K SN The corresponding candidate cells are associated with multiple K SN Each candidate cell can be selected from a set of K cells corresponding to each candidate cell according to the number of times the terminal device accesses the candidate cell. SN Select the corresponding K SN .or

[0432] It should be understood that, taking the candidate cell as the first cell mentioned above as an example, a group of K SN Corresponding to the second set above.

[0433] For example, candidate cell 1 corresponds to a group of K SN When the terminal device switches to the candidate cell 1 for the first time, the candidate cell 1 can be switched to the candidate cell 1 for the first time from the group K corresponding to the candidate cell 1. SN Select the first K SN When the terminal device switches to candidate cell 2 for the first time, candidate cell 2 corresponds to a group of K SN The candidate cell 2 can be switched to the cell for the first time by the terminal device, from the group K corresponding to the candidate cell 2. SN Select the first K SN When the terminal device switches to the candidate cell 1 for the second time, the candidate cell 1 can be switched to the candidate cell 1 for the second time according to the K SN Select the second K SN .

[0434] Another possible implementation method is that the SN add request message may include a set of K corresponding to each candidate SN. SN The group K SN The corresponding candidate SNs are associated with multiple K SN Each candidate SN can be selected from a set of K corresponding to each candidate SN according to the number of times the terminal device accesses the candidate SN. SN Select the corresponding K SN .

[0435] It should be understood that, taking the candidate cell as the first cell mentioned above as an example, the candidate SN to which the candidate cell belongs is the secondary station to which the first cell belongs, and a group of K SN Corresponding to the second set above.

[0436] For example, candidate SN1 corresponds to a set of K SNWhen the terminal device switches to the candidate cell under the candidate SN1 for the first time, the candidate SN1 can be switched from the group of K cells corresponding to the candidate SN1 according to whether the terminal device switches to the SN for the first time. SN Select the first K SN When the terminal device switches to the candidate cell under candidate SN2 for the first time, candidate SN2 corresponds to a group of K SN The candidate SN2 can be switched to the SN for the first time by the terminal device, from the group K corresponding to the candidate SN2 SN Select the first K SN When the terminal device switches to the candidate cell under the candidate SN1 for the second time, the candidate SN1 can be switched to the SN for the second time from the group of K cells corresponding to the candidate SN1. SN Select the second K SN .

[0437] It should be understood that the method shown in FIG7 is to send the starting K corresponding to each candidate cell to each candidate cell at the beginning. SN , or send the starting K corresponding to each candidate SN to each candidate SN SN , each time the terminal device triggers CPA or CPC, the MN will send the updated K to the corresponding candidate cell or candidate SN SN The selected candidate cell or the secondary station to which the selected candidate cell belongs can obtain the updated K only after receiving the reconfiguration completion message from the MN. SN Compared with the method shown in FIG7 , the embodiment shown in FIG8 divides the multiple K SN Send it to the candidate SN in advance, so that the candidate SN does not need to obtain the updated K only after receiving the reconfiguration completion message from the MN. SN That is, the candidate SN does not need to start secure data or signaling communication with the terminal device after receiving the reconfiguration completion message from the MN, which reduces the delay and improves the reconfiguration efficiency.

[0438] Step 825: The candidate SN sends an SN add request confirmation message to the MN.

[0439] Step 830: The MN sends an RRC reconfiguration message to the terminal device.

[0440] The RRC reconfiguration message sent by the MN to the terminal device may include a CPAC configuration, which may include the configuration of the candidate cell and the corresponding execution conditions. The RRC reconfiguration message also indicates a group of SN Counters corresponding to each candidate cell or each candidate SN.

[0441] There are multiple ways for the RRC reconfiguration message to indicate a set of SN Counters corresponding to each candidate cell or each candidate SN. For example, the RRC reconfiguration message includes multiple SN Counters corresponding to each candidate cell or each candidate SN, which can also be called a list or set of SN Counters corresponding to each candidate cell or each candidate SN. For another example, the RRC reconfiguration message includes the starting value and available number of SN Counters corresponding to each candidate cell or each candidate SN, and the multiple SN Counters corresponding to each candidate cell or each candidate SN are determined by the starting value and available number. In this article, the SN Counter set corresponding to each candidate cell or each candidate SN is used to represent the multiple SN Counters corresponding to each candidate cell or each candidate SN.

[0442] It should be understood that, taking the candidate cell as the first cell mentioned above as an example, the SN Counter set of the first cell corresponds to the first set mentioned above.

[0443] It should be understood that, taking the candidate cell as the first cell mentioned above as an example, the SN to which the candidate cell belongs is the secondary station to which the first cell belongs, and the SN Counter set of the candidate SN to which the first cell belongs corresponds to the first set mentioned above.

[0444] Step 835: The terminal device replies to the MN with an RRC reconfiguration completion message.

[0445] Step 840: The terminal device evaluates whether the candidate cells included in the CPAC configuration meet the execution conditions.

[0446] Step 845: The terminal device determines K based on the first SN Counter in the SN Counter set corresponding to the candidate cell or candidate SN included in the CPAC configuration. SN .

[0447] If the terminal device evaluates a candidate cell that meets the conditions, or the terminal device accesses a candidate cell that meets the conditions, the terminal device determines the SN Counter to be used from the multiple SN Counters corresponding to each candidate cell or each candidate SN, and uses the selected SN Counter to determine K SN .

[0448] Exemplarily, the terminal device may determine the SN Counter to be used from multiple SN Counters based on the number of times the terminal device accesses the candidate cell or accesses the SN to which the candidate cell belongs.

[0449] For example, when the terminal device detects that the candidate cell that meets the execution condition is candidate cell 1, since the terminal device is connected to candidate cell 1 or SN1 to which candidate cell 1 belongs for the first time, the terminal device can use the first SN Counter in the SN Counter set corresponding to candidate cell 1 or SN1 to which candidate cell 1 belongs included in the CPAC configuration to determine K SN .

[0450] The terminal device can store the above K SN , can also be based on the above K SN The user plane key for encrypting data or protecting data integrity between the candidate cell 1 can also be derived based on the above K SN A control plane key for encrypting signaling or protecting data integrity with the candidate cell 1 is derived.

[0451] It should be understood that, taking candidate cell 1 as the first cell mentioned above, the SN Counter set corresponding to candidate cell 1 corresponds to the first set mentioned above, and the first SN Counter in the SN Counter set corresponding to candidate cell 1 corresponds to the first parameter value mentioned above. K is determined using the first SN Counter. SN Corresponding to the first key above.

[0452] It should be understood that, taking candidate cell 1 as the first cell mentioned above, the SN Counter set corresponding to SN1 to which candidate cell 1 belongs corresponds to the first set mentioned above, and the first SN Counter in the SN Counter set corresponding to SN1 to which candidate cell 1 belongs corresponds to the first parameter value mentioned above. K is determined using the first SN Counter. SN Corresponding to the first key above.

[0453] Step 850: The terminal device sends an RRC reconfiguration complete message to the MN, where the RRC reconfiguration complete message includes a reconfiguration complete message sent to the candidate SN1.

[0454] As an example, assuming that the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 1, the terminal device can send an RRC reconfiguration complete message to the MN, and the RRC reconfiguration complete message includes a reconfiguration complete message sent to candidate SN1 (the candidate SN where candidate cell 1 is located). The RRC reconfiguration complete message can indicate that the candidate cell selected by the terminal device is candidate cell 1.

[0455] Step 855: The MN forwards the SN reconfiguration completion message to the candidate SN1.

[0456] Step 860: The terminal device performs synchronization with the candidate SN1.

[0457] The terminal device can perform synchronization to the candidate SN1 where the candidate cell 1 is located. As an example, the synchronization process can be implemented through RACH. During the RACH process or before the RACH process, the candidate SN1 can determine the K corresponding to the candidate cell 1 or the SN1 to which the candidate cell 1 belongs. SN The first K in the set SN .

[0458] In the embodiment of the present application, the selected candidate cell or the secondary station to which the selected candidate cell belongs determines the K SN There are many ways to do this.

[0459] In a possible implementation, the terminal device sends a first identifier to the SN to which the candidate cell belongs, where the first identifier is used to indicate the selected candidate cell or the multiple K corresponding to the SN to which the selected candidate cell belongs. SN K used in SN Or the first identifier can be understood as indicating which K SN The SN to which the candidate cell belongs receives the first identifier and determines multiple K SN K to be used in SN . The first identifier can be a key identifier or an SN Counter identifier. The first identifier can be included in Msg3 of the RACH process, or can be included in a MAC CE (for example, included in a C-RATI MAC CE, or included in a first MAC CE, the first MAC CE is used to carry the first identifier). The first identifier can be sent during the RACH process, or before or after the RACH process.

[0460] In another possible implementation, the SN to which the selected candidate cell belongs is selected from multiple K nodes corresponding to the candidate cell or the secondary station to which the candidate cell belongs, based on the number of times the terminal device accesses the candidate cell or the SN to which the candidate cell belongs. SN Select the K used in SN For example, if the terminal device accesses the candidate cell or the SN to which the candidate cell belongs for the first time, the SN selects the first K SN For another example, if the terminal device accesses the candidate cell or the SN to which the candidate cell belongs for the second time, the SN selects the second K SN .

[0461] For the above two possible implementation paradigms, for example, the selected candidate cell is candidate cell 1, and the secondary station to which candidate cell 1 belongs is SN1. Candidate cell 1 or SN1 can be selected from the K corresponding to candidate cell 1 or SN1 according to the first identifier or the number of times the terminal device accesses candidate cell 1 or SN1. SN Select the corresponding K in the set SN For example, since the terminal device selects the first SN Counte from the SN Counte set corresponding to the candidate cell 1 or SN1, K is derived. SN Therefore, the terminal device can also send a first identifier to SN1, which is used to instruct SN1 to select the candidate cell 1 or the K corresponding to SN1. SN Select the first K in the set SN For another example, SN1 can be selected from the K corresponding to the candidate cell 1 or SN1 according to whether the terminal device is accessing the candidate cell 1 or SN1 for the first time. SN Select the first K in the set SN .

[0462] It should be understood that, taking candidate cell 1 as the first cell in the above text as an example, the K corresponding to candidate cell 1 is SN The set corresponds to the second set above, the K SN The first K in the set SN Corresponding to the first key above.

[0463] It should be understood that, taking candidate cell 1 as the first cell in the above text, SN1 to which candidate cell 1 belongs corresponds to the secondary station to which the first cell in the text belongs, and K corresponding to SN1 SN The set corresponds to the second set above, the K SN The first K in the set SN Corresponding to the first key above.

[0464] Similarly, candidate cell 1 or SN1 can also be based on K SN The first K in the set SN Derive the user plane key for encrypting data or protecting data integrity between the terminal device, and also can be based on K SN The first K in the set SN A control plane key is derived for encrypting signaling with the terminal device or protecting data integrity.

[0465] It should be noted that the execution order of the above steps 840, 845, 850, 855 and 860 is not limited. For example, step 845 may be performed first, then step 850, 855 and 860, and then step 845. In this case, the terminal evaluates the candidate cell that meets the conditions and sends an RRC reconfiguration completion message to the MN. The reconfiguration completion message indicates the candidate cell selected by the terminal device. The MN sends an SN reconfiguration completion message to the SN to which the selected candidate cell belongs. The SN can determine the K to be used based on the number of times the terminal device accesses the candidate cell or the SN to which the candidate cell belongs. SN (For details, please refer to the description in step 860, which will not be repeated here), and the terminal device is informed of the SN Counter to be used through the second identifier. The terminal device selects the SN Counter to be used from the multiple SN Counters corresponding to the candidate cell or the SN to which the candidate cell belongs according to the second identifier, and uses the selected SN Counter to derive K SN .

[0466] Step 865: The terminal device evaluates whether the candidate cells included in the CPAC configuration meet the execution conditions.

[0467] Step 868: The terminal device determines K according to the first SN Counter in the group corresponding to the candidate cell 5 or the SN2 to which the candidate cell 5 belongs included in the CPAC configuration. SN .

[0468] When the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 5, since the terminal device is connected to candidate cell 5 for the first time, or is accessing SN2 where candidate cell 5 is located for the first time, the terminal device can use the first SN Counter in a group of SN Counters corresponding to candidate cell 5 or SN2 included in the CPAC configuration to determine K SN .

[0469] The terminal device can also be based on the above K SN The user plane key for encrypting data or protecting data integrity between the candidate cell 5 can also be derived based on the above K SN A control plane key for encrypting signaling with the candidate cell 5 or protecting data integrity is derived.

[0470] Step 870: The terminal device sends an RRC reconfiguration complete message to the MN, where the RRC reconfiguration complete message includes a reconfiguration complete message sent to the candidate SN1.

[0471] Step 875: The MN forwards the SN reconfiguration completion message to the candidate SN2.

[0472] Step 880: The terminal device performs synchronization with the candidate SN2.

[0473] The terminal device can perform synchronization to the candidate SN2 where the candidate cell 5 is located. As an example, the synchronization process can be implemented through RACH. During the RACH process or before the RACH process, the candidate SN2 can select the K corresponding to the candidate cell 5 or the candidate SN2. SN The first K in the set SN .

[0474] Similarly, candidate cell 5 or candidate SN2 can also be based on its corresponding K SN The first K in the set SN Derive the user plane key for encrypting data between the terminal device or protecting data integrity, and also can be based on the corresponding K SN The first K in the set SN A control plane key is derived for encrypting signaling with the terminal device or protecting data integrity.

[0475] Step 885: The terminal device evaluates whether the candidate cells included in the CPAC configuration meet the execution conditions.

[0476] Step 890: The terminal device determines K according to the second SN Counter in a group of SN Counters corresponding to the candidate cell 1 or SN1 to which the candidate cell 1 belongs included in the CPAC configuration. SN .

[0477] When the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 1, since the terminal device is connected to candidate cell 1 or SN1 to which candidate cell 1 belongs for the second time, the terminal device can use the second SN Counter in the SN Counter set corresponding to candidate cell 1 or SN1 to which candidate cell 1 belongs included in the CPAC configuration to determine K SN .

[0478] Step 895: The terminal device sends an RRC reconfiguration complete message to the MN, where the RRC reconfiguration complete message includes a reconfiguration complete message sent to the candidate SN1.

[0479] Step 898: The MN forwards the SN reconfiguration completion message to the candidate SN1.

[0480] Step 899: The terminal device performs synchronization with the candidate SN1.

[0481] The terminal device can perform synchronization to the candidate SN1 where the candidate cell 1 is located. As an example, the synchronization process can be implemented through RACH. During the RACH process or before the RACH process, the candidate SN1 can use the K corresponding to the candidate cell 1 or the SN1 to which the candidate cell 1 belongs. SN The second K in the set SN .

[0482] Similarly, candidate cell 1 or SN1 can also be based on K SN The second K in the set SN Derive the user plane key for encrypting data or protecting data integrity between the terminal device, and also can be based on K SN The second K in the set SN A control plane key is derived for encrypting signaling with the terminal device or protecting data integrity.

[0483] In the above technical solution, a K corresponding to each candidate cell or each candidate SN is sent to the candidate SN in advance. SN The candidate SN can communicate securely with the terminal device only after receiving the reconfiguration completion message from the MN.

[0484] Figure 9 is a schematic flow chart of another communication method provided by an embodiment of the present application. As shown in Figure 9, the method may include steps 910-920, which are described in detail below.

[0485] Step 910: Derive a fourth key, where the fourth key is determined based on the fifth key.

[0486] As an example, in the embodiment of the present application, the fourth key may be derived based on the fifth key. For example, the terminal device may derive the fourth key based on the fifth key.

[0487] It should be noted that the terminal device can evaluate whether the execution condition of the second cell is met, where the second cell is a candidate cell added or changed to the conditional cell. If the terminal device evaluates that the execution condition of the second cell is met, the terminal device can derive a fourth key, which can be used for the security of the second cell.

[0488] It should be noted that the terminal device does not necessarily perform key derivation immediately after evaluating a candidate cell that meets the execution conditions. For example, the terminal device performs key derivation during or after accessing the selected candidate cell.

[0489] In one possible implementation, the terminal device may derive the fourth key based on the fifth key and using a fourth parameter value, where the fourth parameter value is a parameter value associated with the second cell or the secondary station to which the second cell belongs. The embodiment of the present application does not specifically limit the fourth parameter value, and it may be a parameter value associated with the second cell or the secondary station to which the second cell belongs, or it may be updated based on the fifth parameter value, or it may be determined based on the number of times the second cell or the secondary station to which the second cell belongs is accessed. The fifth parameter value is the parameter value last used by the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is the parameter value used by the terminal device last access.

[0490] The present application embodiment does not specifically limit the fifth key. Several possible implementations are described below with examples.

[0491] In one example, the fifth key may be the key of the last cell accessed by the terminal device, that is, the fourth key may be derived based on the key of the last cell accessed by the terminal device. The specific implementation process of this method will be described in detail below in conjunction with Figure 10 and will not be described in detail here.

[0492] It should be understood that the fourth key is the K to be used by the terminal device. SN The fifth key is the K used on the terminal device. SN .

[0493] In another example, the fifth key may also be the key used by the terminal device when it last accessed the second cell or accessed the secondary station to which the second cell belongs. That is, the fourth key may be derived based on the key used by the terminal device when it last accessed the second cell or accessed the secondary station to which the second cell belongs. The specific implementation process of this method will be described in detail below in conjunction with Figure 11 and will not be described in detail here.

[0494] It should be understood that the fourth key is the K to be used by the terminal device. SN The fifth key is the K used by the terminal device in the last selected candidate cell. SN .

[0495] In another example, the fifth key may also be a key last used by a cell in the second cell set, wherein the second cell set includes the second cell. That is, the terminal device maintains a key (e.g., K SN ) or a count value (e.g., SN Counter). Exemplarily, the count value can be understood as the fourth parameter. When the terminal device switches from a cell in another cell set to a cell in the second cell set, the terminal device derives the fourth key. The terminal device derives the fourth key by determining the fifth key. The fifth key is the K last used by the cell in the second cell set.SN . Exemplarily, the second cell set is used to instruct the terminal device to perform PDCP reconstruction. For example, when the terminal device switches from a cell in the second cell set to another cell in the second cell set, there is no need to perform PDCP reconstruction; when the terminal device switches from a cell outside the second cell set to a cell in the second cell set, it is necessary to perform PDCP reconstruction.

[0496] Exemplarily, the second cell set may be configured by the network device, for example, indicating identifiers of candidate cells included in the second cell set.

[0497] Exemplarily, or the second cell set is not configured by the network device. The second cell set includes cells with the same key (eg K SN ) or count value (such as SN Counter). SN ) or a count value (such as SN Counter) is switched to a second cell, or in the case of switching from a cell with a different count value to the second cell, the terminal device derives the fourth key.

[0498] In another example, the fifth key may also be the key last used by the fourth cell, where the fourth cell is configured with the same count value (eg, SN Counter) or key (K SN ). For example, the count value can be understood as the fourth parameter. That is, the terminal device maintains a K for each candidate cell. SN Or SN Counter. SN Counter or K of different candidate cells SN They can be the same or different. When a terminal device switches from another cell to a second cell, if the SN Counter or K SN Different, the terminal device derives the fourth key. The terminal device derives the fourth key through the fifth key. The fifth key is the same SN Counter or K as the second cell. SN The K used last time in the cell SN The fourth cell may also be the second cell.

[0499] Step 920: Derive a sixth key based on the fourth key, where the sixth key is a user plane key and / or a control plane key.

[0500] In this embodiment of the present application, a sixth key may be derived from the fourth key, that is, the sixth key is a user plane key and / or a control plane key derived from the fourth key. The control plane key and / or the user plane key is used to encrypt or protect the data integrity of data and / or signaling between the terminal device and the second cell. The user plane key is used to encrypt or protect the data integrity of data between the terminal device and the second cell.

[0501] Optionally, in some embodiments, the MN may derive a fourth key based on the fifth key, and send the derived fourth key to the second cell or the secondary station to which the second cell belongs. The process of the MN deriving the fourth key based on the fifth key is the same as the process of the terminal device deriving the fourth key based on the fifth key. For details, please refer to the description in step 910, which will not be repeated here. In some embodiments, the MN may include multiple possible K keys in the Xth message. SN The Xth message may be a SN add request message. In this implementation, if the SN considers that the received K SN If all the K SN This request message is used to request multiple K SN Updates.

[0502] Optionally, in some embodiments, the SN may also derive a fourth key based on the fifth key, and derive a sixth key based on the fourth key. The process of deriving the fourth key and the sixth key by the SN is the same as the process of deriving the fourth key and the sixth key by the terminal device. For details, please refer to the description in steps 910 and 920, and will not be repeated here.

[0503] The specific implementation process of deriving the fourth key based on the key of the previous cell accessed by the terminal device in step 910 is described in detail below in conjunction with Figure 10. It should be understood that the example of Figure 10 is merely to help those skilled in the art understand the embodiments of the present application, and is not intended to limit the embodiments of the application to the specific numerical values ​​or specific scenarios illustrated. It is obvious that those skilled in the art can make various equivalent modifications or changes based on the following example given in Figure 10, and such modifications and changes also fall within the scope of the embodiments of the present application.

[0504] Figure 10 is a schematic flow chart of another communication method provided by an embodiment of the present application. As shown in Figure 10, the method may include steps 1010-1099, and steps 1010-1099 are described in detail below.

[0505] Step 1010: The terminal device establishes an RRC connection with the MN.

[0506] Step 1015: The terminal device establishes an RRC connection with the source SN.

[0507] It should be noted that step 1015 is optional.

[0508] Step 1020: The MN sends an SN add request message to the candidate SN.

[0509] As an example, the MN sends an SN add request message to the candidate SN1 and the candidate SN2 respectively. The SN add request message may include K SN #0, the K SN #0 is calculated by MN based on SN Counter. Assuming that the SN Countere corresponding to each candidate cell is the same, all are SN Counter#0, MN can calculate K based on SN Counter#0 SN #0.

[0510] Step 1025: The candidate SN sends an SN add request confirmation message to the MN.

[0511] Step 1030: The MN sends an RRC reconfiguration message to the terminal device.

[0512] The RRC reconfiguration message sent by the MN to the terminal device may include the CPAC configuration, which may include the configuration of the candidate cells included in the candidate SN1 and the candidate SN2 and the corresponding execution conditions, as well as the MN derived K SN SN Counter #0 (for example, SN Counter #0).

[0513] Step 1035: The terminal device replies to the MN with an RRC reconfiguration completion message.

[0514] Step 1040: The terminal device evaluates whether the candidate cells included in the CPAC configuration meet the execution conditions.

[0515] Step 1045: The terminal device sends an RRC reconfiguration complete message to the MN, where the RRC reconfiguration complete message includes a reconfiguration complete message sent to the candidate SN1.

[0516] As an example, assuming that the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 1, the terminal device can send an RRC reconfiguration complete message to the MN, and the RRC reconfiguration complete message includes a reconfiguration complete message sent to candidate SN1 (the candidate SN where candidate cell 1 is located). The RRC reconfiguration complete message can indicate that the candidate cell selected by the terminal device is candidate cell 1.

[0517] Step 1050: The MN forwards the SN reconfiguration completion message to the candidate SN1.

[0518] Step 1055: The terminal device derives K based on the SN Counter included in the CPAC configuration. SN #0.

[0519] As an example, after receiving the CPAC configuration, the terminal device may use the SN Counter (eg, SN Counter #0) and K gNB Derived K SN #0. The terminal device can also be based on K SN #0 derives a user plane key for encrypting data or protecting data integrity between the candidate cell 1 and the candidate cell 1, based on K SN #0 derives a control plane key for encrypting signaling or protecting data integrity with the candidate cell 1.

[0520] Step 1060: The terminal device performs synchronization with the candidate SN1.

[0521] The terminal device can perform synchronization to the candidate SN1 where the candidate cell 1 is located. As an example, the synchronization process can be implemented through RACH. The candidate cell 1 can also be based on the received K SN #0 derives a user plane key for encrypting data between the terminal device or protecting data integrity, and can also be based on K SN #0 Derive a control plane key for encrypting signaling or protecting data integrity with the terminal device.

[0522] Step 1063: The terminal device continues to evaluate whether the candidate PSCells included in the CPAC configuration meet the execution conditions.

[0523] Step 1065: The terminal device receives the data according to K SN #0 Derived K SN #1.

[0524] For example, assuming that the terminal device detects that the candidate cell that meets the execution condition is candidate cell 5, the terminal device can use the K SN #0 derive and save K SN #1.

[0525] In another example, when the terminal device detects that the candidate cell that meets the execution condition is candidate cell 5, assuming that candidate cell 1 belongs to one cell set and candidate cell 5 belongs to another cell set, when the terminal device switches from a cell in the cell set to which candidate cell 1 belongs to to a cell in the cell set to which candidate cell 5 belongs, the K last used by the cell in the cell set to which candidate cell 5 belongs can be used. SN #0 derive and save K SN #1.

[0526] In another example, when the terminal device detects that the candidate cell that meets the execution condition is candidate cell 5, assuming that the SN Counter or K of candidate cell 5 and candidate cell 1 are SN Different, the K used last time by candidate cell 10 can be used SN #0 derive and save K SN #1. Among them, candidate cell 10 and candidate cell 5 are configured with the same SN Counter or K SN .

[0527] The terminal device can also be based on K SN #1 derives a user plane key for encrypting data or protecting data integrity between the candidate cell 5 and the user plane key for encrypting data or protecting data integrity. SN #1 derives a control plane key for encrypting signaling or protecting data integrity with the candidate cell 5 .

[0528] It should be understood that, taking the candidate cell 5 as the second cell in the above text as an example, K SN #0 corresponds to the fifth key above, K SN #1 corresponds to the fourth key above.

[0529] Step 1070: The terminal device sends an RRC reconfiguration complete message to the MN, where the RRC reconfiguration complete message includes an RRC reconfiguration complete message sent to the candidate SN2.

[0530] As an example, when the terminal device detects that the candidate cell 5 meets the execution condition, the terminal device may send an RRC reconfiguration complete message to the MN, where the RRC reconfiguration complete message includes a reconfiguration complete message sent to candidate SN2 (the candidate SN where candidate cell 5 is located). The RRC reconfiguration complete message may indicate that the terminal device has selected candidate cell 5.

[0531] It should be noted that the implementation of this application does not specifically limit the execution order of step 1065 and step 1070. Step 1065 can be executed first, and then step 1070; or, step 1070 can be executed first, and then step 1065; or, step 1065 and step 1070 can be executed at the same time.

[0532] Step 1075: MN calculates the value of K SN #0 Derived K SN #1.

[0533] In the embodiment of the present application, after receiving the RRC reconfiguration completion message sent by the terminal device, the MN can use the key K of the previous cell accessed by the terminal device to SN #0 derive and save K SN #1.

[0534] In a possible implementation, the K SN #0 and the fifth SN Counter derived K SN #1. In one example, the fifth SN Counter may be the SN Counter associated with candidate cell 5 or SN2 to which candidate cell 5 belongs. In another example, the fifth SN Counter may be updated based on the sixth SN Counter, where the sixth SN Counter is the SN Counter last used by candidate cell 5 or SN2 to which candidate cell 5 belongs, or the SN Counter last accessed by the terminal device. In another example, the fifth SN Counter may be determined based on the number of accesses to candidate cell 5 or SN2 to which candidate cell 5 belongs.

[0535] It should be understood that K SN #0 corresponds to the fifth key above, K SN Take #1 as an example, which corresponds to the fourth key mentioned above. The fifth SN Counter corresponds to the fourth parameter value mentioned above, and the sixth SN Counter corresponds to the fifth parameter value mentioned above.

[0536] In another possible implementation, the terminal device can SN #0 and SN Counter #0 derived K SN #1. SN Counter #0 is the SN Counter used by all candidate cells or all candidate SNs.

[0537] It should be understood that K SN #0 corresponds to the fifth key above, K SN For example, #1 corresponds to the fourth key mentioned above, and SN Counter #0 corresponds to the fourth parameter value mentioned above.

[0538] Step 1078: The MN forwards the SN reconfiguration completion message to the candidate SN2.

[0539] In the embodiment of the present application, the MN may select the candidate cell 5 as the candidate cell selected by the terminal device according to the RRC reconfiguration completion message, and forward the SN reconfiguration completion message to the candidate SN2 where the candidate cell 5 is located.

[0540] Optionally, the MN may also forward the SN reconfiguration completion message to the candidate SN2 including K SN #1.

[0541] Step 1080: The terminal device performs synchronization with the candidate SN2.

[0542] The terminal device may perform synchronization to the candidate SN2 where the candidate cell 5 is located. As an example, the synchronization process may be implemented through RACH.

[0543] Candidate cell 5 can also be based on K SN #1 derives a user plane key for encrypting data between the terminal device or protecting data integrity, and can also be based on K SN #1 Derive a control plane key for encrypting signaling or protecting data integrity with the terminal device.

[0544] It should be understood that in the embodiment of the present application, the candidate cell 5 obtains K SN There are many ways to implement #1. For example, the reconfiguration completion message sent by MN to candidate SN2 includes K SN #1, candidate cell 5 can obtain K from this message SN #1. Another example, candidate cell 5 can use the key K of the last cell accessed by the terminal device. SN #0 Derived K SN #1. At this time, the RRC reconfiguration complete message sent by MN to candidate SN2 does not include K SN #1. For details, please refer to step 1075 where MN is based on K SN #0 Derived K SN The process of #1 will not be repeated here.

[0545] Step 1083: The terminal device continues to evaluate whether the candidate cells included in the CPAC configuration meet the execution conditions.

[0546] Step 1085: The terminal device receives the data according to K SN #1 Derived K SN #2.

[0547] As an example, assuming that the terminal device detects that the candidate cell that meets the execution condition is candidate cell 1, the terminal device can select the candidate cell 1 according to the K SN #1 derive and save K SN #2.

[0548] The terminal device can also be based on K SN #2 derive the user plane key for encrypting data or protecting data integrity between the candidate cell 1 and the candidate cell 1, and can also be based on K SN #2 derives a control plane key for encrypting signaling or protecting data integrity with the candidate cell 1.

[0549] It should be understood that, taking candidate cell 1 as the second cell in the above text as an example, K SN #1 corresponds to the fifth key above, K SN #2 corresponds to the fourth key above.

[0550] Step 1090: The terminal device sends an RRC reconfiguration complete message to the MN, where the RRC reconfiguration complete message includes a reconfiguration complete message sent to the candidate SN1.

[0551] Step 1093: MN calculates the value of K SN #1 Derived K SN #2.

[0552] In the embodiment of the present application, after receiving the RRC reconfiguration completion message sent by the terminal device, the MN can use K SN #1 Derived K SN #2.

[0553] Step 1095: The MN forwards the SN reconfiguration completion message to the candidate SN1.

[0554] Optionally, the SN reconfiguration completion message forwarded by the MN to the candidate SN1 may also include K SN #2.

[0555] Step 1099: The terminal device performs synchronization with the candidate SN1.

[0556] The terminal device can perform synchronization to the candidate SN1 where the candidate cell 1 is located. As an example, the synchronization process can be implemented through RACH. The candidate cell 1 can also be based on K SN #2 derives a user plane key for encrypting data between the terminal device or protecting data integrity, and can also be based on K SN #2 Derive a control plane key for encrypting signaling or protecting data integrity with the terminal device.

[0557] Candidate cell 1 can obtain K from the RRC reconfiguration complete message sent by the terminal device. SN #2, or you can also use K SN #1 Derived K SN #2. Please refer to the above description for details, which will not be repeated here.

[0558] In the above technical solution, each time the terminal device triggers an SN change, the K SN , derive a new K SN . Every time CPA or CPC is triggered, the terminal device uses K SN are different, thus ensuring that new K is derived during the candidate CPAC process. SN , avoiding the problem of key reuse.

[0559] The following, in conjunction with Figure 11, describes in detail the specific implementation process of deriving the fourth key in step 910 based on the key used by the terminal device when it last accessed the second cell or accessed the secondary station to which the second cell belongs. It should be understood that the example in Figure 11 is only to help those skilled in the art understand the embodiments of the present application, and is not intended to limit the embodiments of the application to the specific numerical values ​​or specific scenarios illustrated. Based on the following example given in Figure 11, those skilled in the art can obviously make various equivalent modifications or changes, and such modifications and changes also fall within the scope of the embodiments of the present application.

[0560] Figure 11 is a schematic flow chart of another communication method provided by an embodiment of the present application. As shown in Figure 11, the method may include steps 1110-1199, which are described in detail below.

[0561] Step 1110: The terminal device establishes an RRC connection with the MN.

[0562] Step 1115: The terminal device establishes an RRC connection with the source SN.

[0563] It should be noted that step 1115 is optional.

[0564] Step 1120: The MN sends an SN add request message to the candidate SN.

[0565] As an example, the MN sends an SN add request message to the candidate SN1 and candidate SN2 respectively. The SN add request message may include the starting K corresponding to each candidate cell or each candidate SN. SN , the starting K corresponding to each candidate cell or each candidate SN SN It is calculated by the MN based on the starting SN Counter corresponding to each candidate cell or each candidate SN.

[0566] It should be understood that the starting SN Counter corresponding to each candidate cell or each candidate SN can be the SN Counter starting value (SN Counter#x) of each candidate cell or each candidate SN, or it can also be the first SN Counter in the SN Counter value set corresponding to each candidate cell or each candidate SN. The embodiment of the present application does not limit this. Please refer to the description above for details, and no further details will be given here.

[0567] For example, assume that the MN derives the starting K from the SN Counter corresponding to candidate cell 1. SN K SN#1 , the starting K derived from the SN Counter corresponding to candidate cell 2 SN K SN#2, the starting K derived from the SN Counter corresponding to candidate cell 3 SN K SN#3 etc. Or,

[0568] Assume that MN derives the starting K according to the SN Counter corresponding to candidate SN1 SN K SN#1 , the starting K derived from the SN Counter corresponding to candidate SN2 SN K SN#2 etc.

[0569] Step 1125: The candidate SN sends an SN add request confirmation message to the MN.

[0570] Step 1130: The MN sends an RRC reconfiguration message to the terminal device.

[0571] The RRC reconfiguration message sent by the MN to the terminal device may include a CPAC configuration, which may include the configuration of the candidate cells included in the candidate SN1 and candidate SN2 and the corresponding execution conditions, as well as the SN Counter corresponding to each candidate cell or each candidate SN.

[0572] Step 1135: The terminal device replies to the MN with an RRC reconfiguration completion message.

[0573] Step 1140: The terminal device evaluates whether the candidate cells included in the CPAC configuration meet the execution conditions.

[0574] Step 1145: The terminal device determines and saves K according to the SN Counter included in the CPAC configuration. SN#1 .

[0575] After receiving the CPAC configuration, if the terminal device evaluates that a candidate cell or a candidate cell under a candidate SN meets the execution conditions for the first time, or the terminal device accesses a candidate cell (or a candidate cell under a candidate SN) that meets the execution conditions for the first time, the terminal device derives K based on the master key and uses the SN Counter corresponding to the candidate cell or the secondary station to which the candidate cell belongs. SN For example, when the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 1, it can determine and save K based on the master key and use the SN Counter corresponding to the candidate cell 1 or the SN1 to which the candidate cell 1 belongs included in the CPAC configuration. SN#1 .

[0576] Step 1150: The terminal device sends an RRC reconfiguration complete message to the MN, where the RRC reconfiguration complete message includes a reconfiguration complete message sent to the candidate SN1.

[0577] Step 1155: The MN forwards the SN reconfiguration completion message to the candidate SN1.

[0578] It should be noted that the implementation of this application does not specifically limit the execution order of step 1145, step 1150 and step 1155. Step 1145 can be executed first, and then step 1150 and step 1155; or, step 1150 and step 1155 can be executed first, and then step 1145; or, step 1145, step 1150 and step 1155 can be executed simultaneously.

[0579] Step 1160: The terminal device performs synchronization with the candidate SN1.

[0580] The terminal device can perform synchronization to the candidate SN1 where the candidate cell 1 is located. As an example, the synchronization process can be implemented through RACH. The candidate cell 1 can also be based on the received K SN#1 Derive the user plane key for encrypting data or protecting data integrity between the terminal device, and also can be based on K SN#1 A control plane key is derived for encrypting signaling with the terminal device or protecting data integrity.

[0581] Step 1163: The terminal device continues to evaluate whether the candidate cells included in the CPAC configuration meet the execution conditions.

[0582] Step 1165: The terminal device determines and saves K according to the SN Counter included in the CPAC configuration. SN#5 .

[0583] For example, when the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 5, since the terminal device is accessing candidate cell 5 or SN2 to which candidate cell 5 belongs for the first time, it can use the SN Counter corresponding to the candidate cell 5 or SN2 included in the CPAC configuration to determine and save K SN#5 .

[0584] In another example, when the terminal device detects that the candidate cell that meets the execution condition is candidate cell 5, assuming that candidate cell 1 belongs to one cell set and candidate cell 5 belongs to another cell set, when the terminal device switches from a cell in the cell set to which candidate cell 1 belongs to to a cell in the cell set to which candidate cell 5 belongs, the K last used by the cell in the cell set to which candidate cell 5 belongs can be used. SN (For example, K SN#5 ).

[0585] In another example, when the terminal device detects that the candidate cell that meets the execution condition is candidate cell 5, if the SN Counter or K SN Different, the K used last time by candidate cell 10 can be used SN (For example, K SN#5 ). Among them, candidate cell 10 and candidate cell 5 are configured with the same SN Counter or K SN .

[0586] Step 1170: The terminal device sends an RRC reconfiguration complete message to the MN, where the RRC reconfiguration complete message includes a reconfiguration complete message sent to the candidate SN1.

[0587] Step 1175: The MN forwards the SN reconfiguration completion message to the candidate SN1.

[0588] Similarly, the implementation of this application does not specifically limit the execution order of step 1165, step 1170 and step 1175. Step 1165 can be executed first, and then step 1170 and step 1175; or, step 1170 and step 1175 can be executed first, and then step 1165; or, step 1165, step 1170 and step 1175 can be executed simultaneously.

[0589] Step 1180: The terminal device performs synchronization with the candidate SN2.

[0590] The terminal device can perform synchronization to the candidate SN2 where the candidate cell 5 is located. As an example, the synchronization process can be implemented through RACH. The candidate cell 5 can also be based on the received K SN#5 Derive the user plane key for encrypting data or protecting data integrity between the terminal device, and also can be based on K SN#5 Deriving a control plane key for encrypting signaling or protecting data integrity with the terminal device

[0591] Step 1183: The terminal device continues to evaluate whether the candidate cells included in the CPAC configuration meet the execution conditions.

[0592] Step 1185: The terminal device receives the data according to K SN#1 Derived K SN#1-1 .

[0593] If the terminal device evaluates that a candidate cell or a candidate cell under a candidate SN meets the execution conditions again (or a candidate cell or a candidate cell under a candidate SN does not meet the execution conditions for the first time), or the terminal device accesses a candidate cell or a candidate cell under a candidate SN that meets the execution conditions again (or it is not the first time to access a candidate cell or a candidate cell under a candidate SN), the terminal device uses the K used last time in the candidate cell or the SN to which the candidate cell belongs. SN Derive new K SN For example, when the terminal device detects that the candidate cell that meets the execution conditions is candidate cell 1 again, the terminal device can use the K used by the terminal device when it last accessed the candidate cell 1 or the SN1 to which the candidate cell 1 belongs. SN#1 Determine K SN#1-1 .

[0594] Step 1187: The terminal device sends an RRC reconfiguration complete message to the MN, where the RRC reconfiguration complete message includes a reconfiguration complete message sent to the candidate SN1.

[0595] Step 1190: MN calculates the value of K SN#1 Derived K SN#1-1 .

[0596] In the embodiment of the present application, after receiving the RRC reconfiguration completion message sent by the terminal device, the MN can use the K SN#1 Derived K SN#1-1 .

[0597] Step 1195: The MN forwards the SN reconfiguration completion message to the candidate SN1.

[0598] In the embodiment of the present application, the MN may select the candidate cell 1 as the candidate cell selected by the terminal device according to the RRC reconfiguration completion message, and forward the SN reconfiguration completion message to the candidate SN1 where the candidate cell 1 is located.

[0599] Optionally, the SN reconfiguration complete message may also include K SN#1-1 .

[0600] Step 1198: Candidate SN1 is selected based on K SN#1 Derived K SN#1-1 .

[0601] Candidate SN1 can be based on the K used last time by candidate cell 1 or the candidate SN to which candidate cell 1 belongs. SN Derive a new K SN .

[0602] As an example, candidate SN1 can use K SN#1 Derived K SN#1-1It should be understood that the above K SN#1 It can be the K used by the terminal device to access candidate cell 1 last time. SN , or it can be the K corresponding to the candidate SN1 to which the terminal device last accessed the candidate cell 1 SN .

[0603] Optionally, the SN add request message received by the candidate SN1 from the MN includes an SN Counter, for example, the SN Counter may be the SN Counter corresponding to the candidate cell or the SN Counter corresponding to the candidate SN to which the candidate cell belongs. In this implementation, in one possible implementation, the candidate SN1 may be selected based on K SN#1 And the SN Counter derived K SN#1-1 .

[0604] It should be noted that if step 1190 is executed, step 1198 will not be executed; or if step 1198 is executed, step 1190 will not be executed.

[0605] Step 1199: The terminal device performs synchronization to the candidate SN1.

[0606] The terminal device can perform synchronization to the candidate SN1 where the candidate cell 1 is located. As an example, the synchronization process can be implemented through RACH. The candidate cell 1 can also be based on the received K SN#1-1 Derive the user plane key for encrypting data or protecting data integrity between the terminal device, and also can be based on K SN#1-1 A control plane key is derived for encrypting signaling with the terminal device or protecting data integrity.

[0607] In the above technical solution, in the subsequent CPAC process, each time the terminal device triggers CPA or CPC, the terminal device and the MN (or SN) will use the K last used by the selected candidate cell or the secondary station to which the selected candidate cell belongs. SN Derive new K SN By ensuring that K is updated every time during the subsequent CPAC process SN The input key K SN Different, to ensure that when the subsequent CPAC process returns to the previously accessed candidate cell or candidate SN, through different K SN Derive new K SN , avoiding the problem of key reuse.

[0608] The above describes in detail the technical solution provided by the communication method of the embodiment of the present application in combination with Figures 1 to 11. The following introduces the communication device provided by the embodiment of the present application in combination with Figures 12 to 14.

[0609] Figure 12 is a schematic block diagram of a communication device provided in an embodiment of the present application. As shown in Figure 12, device 1200 may include a processing unit 1220, wherein processing unit 1220 is configured to process data / information to implement the functions of the terminal device in the methods shown in Figures 5 to 11 above, or to implement the functions of the network device in the methods shown in Figures 5 to 11 above.

[0610] Optionally, the device 1200 may further include a transceiver unit 1210. The transceiver unit 1210 may communicate with the outside world. For example, the transceiver unit 1210 may input data / information received from the outside world into the processing unit, or output data / information processed by the processing unit to the outside world. The transceiver unit 1210 may also be referred to as a communication interface or a communication unit.

[0611] In one possible implementation, the apparatus 1200 may be a terminal device in the method shown in Figures 5 to 11 above, or may be a chip for implementing the functions of the terminal device in the method shown in Figures 5 to 11 above. Specifically, the apparatus 1200 may implement the process executed by the terminal device in the method shown in Figures 5 to 11 above, wherein the processing unit 1220 is configured to perform operations related to the processing of the terminal device in the above method process.

[0612] In one example, processing unit 1220 is used to derive a first key and derive a third key based on the first key, wherein the first key is based on the second key and is determined using a first parameter value, the second key is a primary key, the first parameter value is updated based on the second parameter value, or the first parameter value is determined based on the number of accesses to the first cell or the secondary station to which the first cell belongs, the third key is a user plane key and / or a control plane key, and the third key is used to encrypt data and / or signaling between the first cell or the secondary station to which the first cell belongs or to protect data integrity.

[0613] Optionally, the second parameter value is a parameter value last used by the first cell or the secondary station to which the first cell belongs, or the second parameter value is a parameter value used during the last access.

[0614] Optionally, the first parameter value is the second parameter value plus N, where N is an integer greater than or equal to 1, or N is the maximum number of candidate cells added or changed in the conditional cell.

[0615] Optionally, the first parameter value is determined according to a third parameter value and the number of times of accessing the first cell or the secondary station to which the first cell belongs, wherein the third parameter value is a starting parameter value associated with the first cell or the secondary station to which the first cell belongs.

[0616] Optionally, the first parameter value is the Pth value in the first set, where P is related to the number of accesses to the first cell or the secondary station to which the first cell belongs, and the first set includes multiple parameter values ​​associated with the first cell or the secondary station to which the first cell belongs.

[0617] Optionally, the transceiver unit 1210 is configured to send the first message to the primary station, where the first message indicates the first cell that meets the execution condition or the secondary station to which the first cell belongs, and the first message includes the first parameter value.

[0618] In another example, the processing unit 1220 is used to derive a fourth key and derive a sixth key based on the fourth key, wherein the fourth key is determined based on the fifth key, the fifth key is the key of the last cell accessed, or the fifth key is the key used for the last access to the second cell or the secondary station to which the second cell belongs, the sixth key is a user plane key and / or a control plane key, and the sixth key is used to encrypt data and / or signaling between the second cell or to protect data integrity.

[0619] Optionally, the processing unit 1220 is specifically configured to derive the fourth key based on the fifth key and using a fourth parameter value, where the fourth parameter value is a parameter value associated with the second cell or a secondary station to which the second cell is connected.

[0620] Optionally, the fourth parameter value is a parameter value associated with the second cell or the secondary station to which the second cell belongs, or the fourth parameter value is updated based on the fifth parameter value, or the fourth parameter value is determined according to the number of times the second cell or the secondary station to which the second cell belongs is accessed.

[0621] Optionally, the fifth parameter value is a parameter value last used by the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is a parameter value used in the last access.

[0622] It should be understood that the above-mentioned processing unit 1220 and transceiver unit 1210 can also respectively execute any other steps, operations and / or functions implemented by the terminal device in the methods shown in Figures 5 to 11 above. The specific process of each unit executing the above-mentioned corresponding steps has been described in detail in the above-mentioned method embodiments. For the sake of brevity, it will not be repeated here.

[0623] In another possible implementation, the apparatus 1200 may be the MN in the methods shown in Figures 5 to 11 above, or may be a chip for implementing the functions of the MN in the methods shown in Figures 5 to 11 above. Specifically, the apparatus 1200 may implement the processes executed by the MN in the methods shown in Figures 5 to 11 above, wherein the processing unit 1220 is configured to perform operations related to the processing of the MN in the above method processes.

[0624] In one example, the processing unit 1220 is configured to derive a first key, where the first key is used for the security of the first cell, the first cell being a candidate cell for adding or changing CPAC for a conditional cell, the first key being determined based on a second key and using a first parameter value, the second key being a master key, the first parameter value being received from a terminal device, or the first parameter value being updated based on the second parameter value, or the first parameter value being determined based on the number of times the terminal device accesses the first cell or the secondary station to which the first cell belongs. The transceiver unit 1210 is configured to send the first key to the first cell or the secondary station to which the first cell belongs.

[0625] Optionally, the transceiver unit 1210 is specifically configured to send a second set to the first cell or the secondary station to which the first cell belongs, where the second set includes multiple keys associated with the first cell or the secondary station to which the first cell belongs, and the multiple keys include the first key.

[0626] Optionally, the transceiver unit 1210 is further configured to receive a first message from the terminal device, where the first message includes the first parameter value, and the first message indicates a first cell that meets the execution condition or a secondary station to which the first cell belongs.

[0627] Optionally, the second parameter value is a parameter value last used by the first cell or the secondary station to which the first cell belongs, or the second parameter value is a parameter value last used by the terminal device for access.

[0628] Optionally, the first parameter value is the second parameter value plus N, where N is an integer greater than or equal to 1, or N is the maximum number of candidate cells added or changed in the conditional cell.

[0629] Optionally, the first parameter value is determined based on a third parameter value and the number of times the terminal device accesses the first cell or the secondary station to which the first cell belongs, wherein the third parameter value is a starting parameter value associated with the first cell or the secondary station to which the first cell belongs.

[0630] Optionally, the first parameter value is the Pth value in the first set, where P is related to the number of times the terminal device accesses the first cell or the secondary station to which the first cell belongs, and the first set includes multiple parameter values ​​associated with the first cell or the secondary station to which the first cell belongs.

[0631] In another example, the processing unit 1220 is used to derive a fourth key, wherein the fourth key is used for the security of the second cell, the fourth key is determined based on a fifth key, the fifth key is the key for the previous cell accessed, or the fifth key is the key used for the last access to the second cell or the secondary station to which the second cell belongs; the transceiver unit 1210 is used to send the fourth key to the second cell or the secondary station to which the second cell belongs.

[0632] Optionally, the processing unit 1220 is specifically configured to derive the fourth key based on the fifth key and using a fourth parameter value, where the fourth parameter value is a parameter value associated with the second cell or a secondary station to which the second cell is connected.

[0633] Optionally, the fifth key is determined based on the sixth key and using a fifth parameter value, the sixth key is the master key, the fifth parameter value is a parameter value associated with the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is updated based on the sixth parameter value, or the fifth parameter value is determined based on the number of times the terminal device accesses the second cell or the secondary station to which the second cell belongs.

[0634] Optionally, the sixth parameter value is a parameter value last used by the second cell or the secondary station to which the second cell belongs, or the sixth parameter value is a parameter value last used by the terminal device for access.

[0635] It should be understood that the above-mentioned processing unit 1220 and transceiver unit 1210 can also respectively execute any other steps, operations and / or functions implemented by the MN in the methods shown in Figures 5 to 11 above. The specific process of each unit executing the above-mentioned corresponding steps has been described in detail in the above-mentioned method embodiments. For the sake of brevity, it will not be repeated here.

[0636] In another possible implementation, the device 1200 may be the SN in the method shown in Figures 5 to 11 above, or may be a chip for implementing the functions of the SN in the method shown in Figures 5 to 11 above. Specifically, the device 1200 may implement a process corresponding to the process executed by the SN in the method shown in Figures 5 to 11 above, wherein the processing unit 1220 is used to perform operations related to the processing of the SN in the above method process.

[0637] In one example, the transceiver unit 1210 is used to receive a second set, which includes multiple keys associated with the first cell or the secondary station to which the first cell belongs, and the multiple keys include a first key; the processing unit 1220 is used to determine the first key from the second set based on a first identifier or the number of times the terminal device accesses the first cell or the secondary station to which the first cell belongs, and the first identifier is used to indicate the position of the first key in the second set.

[0638] Optionally, the transceiver unit 1210 is further configured to receive a second message, where the second message includes the first identifier.

[0639] In another example, the processing unit 1220 is used to derive a fourth key and derive a sixth key based on the fourth key, wherein the fourth key is used for the security of the second cell, the fourth key is determined based on the fifth key, the fifth key is the key used for the last access to the second cell or the access to the secondary station to which the second cell belongs, the sixth key is a user plane key and / or a control plane key, and the sixth key is used to encrypt data and / or signaling between the terminal device or to protect data integrity.

[0640] Optionally, the processing unit 1220 is further configured to derive the fourth key based on the fifth key and using a fourth parameter value, where the fourth parameter value is a parameter value associated with the second cell or a secondary station to which the second cell is connected.

[0641] Optionally, the fifth key is determined based on the sixth key and using a fifth parameter value, the sixth key is the master key, the fifth parameter value is a parameter value associated with the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is updated based on the sixth parameter value, or the fifth parameter value is determined based on the number of times the terminal device accesses the second cell or the secondary station to which the second cell belongs.

[0642] Optionally, the sixth parameter value is a parameter value last used by the second cell or the secondary station to which the second cell belongs, or the sixth parameter value is a parameter value last used by the terminal device for access.

[0643] It should be understood that the above-mentioned processing unit 1220 and transceiver unit 1210 can also respectively perform any other steps, operations and / or functions implemented by the SN in the methods shown in Figures 5 to 11 above. The specific process of each unit performing the above-mentioned corresponding steps has been described in detail in the above-mentioned method embodiments. For the sake of brevity, it will not be repeated here.

[0644] It should also be understood that in any of the above-mentioned implementations, the above-mentioned transceiver unit 1210 may include a receiving unit and a sending unit, wherein the receiving unit is used to perform the receiving function in the above-mentioned transceiver unit 1210, and the sending unit is used to perform the sending function in the above-mentioned transceiver unit 1210.

[0645] The above-mentioned device 1200 has the function of implementing the corresponding steps performed by the terminal device in the method shown in Figures 5 to 11, or the above-mentioned device 1200 has the function of implementing the corresponding steps performed by the network device in the method shown in Figures 5 to 11. The functions can be implemented by hardware, or the corresponding software can be implemented by hardware. The hardware or software includes one or more modules corresponding to the above-mentioned functions; for example, the transceiver unit can be replaced by a transceiver (for example, the sending unit in the transceiver unit can be replaced by a transmitter, and the receiving unit in the transceiver unit can be replaced by a receiver), and other units, such as the processing unit, can be replaced by a processor to respectively perform the sending and receiving operations and related processing operations in each method embodiment.

[0646] It should be understood that the apparatus 1200 herein is embodied in the form of a functional unit. The term "unit" herein may refer to an application specific integrated circuit (ASIC), an electronic circuit, a processor (e.g., a shared processor, a dedicated processor, or a group processor, etc.) and memory for executing one or more software or firmware programs, combined logic circuits, and / or other suitable components that support the described functionality.

[0647] In addition, the above-mentioned transceiver unit can also be a transceiver circuit (for example, it can include a receiving circuit and a transmitting circuit), and the processing unit can be a processing circuit. In an embodiment of the present application, the device 1200 can be a terminal device or network device in the aforementioned embodiment, or it can be a chip or chip system, such as a system on chip (SoC). Among them, the transceiver unit can be an input and output circuit or a communication interface. The processing unit is a processor or microprocessor or integrated circuit integrated on the chip. This is not limited here.

[0648] Figure 13 is another schematic structural diagram of a communication device provided in an embodiment of the present application. As shown in Figure 13, the communication device 1300 includes: at least one processor 1310, which is configured to execute instructions to implement the functions of the terminal device in the methods shown in Figures 5 to 11 above, or to implement the functions of the network device in the methods shown in Figures 5 to 11 above.

[0649] Optionally, the apparatus 1300 may further include a transceiver 1320 , where the transceiver 1320 is configured to send signals and / or receive signals.

[0650] Optionally, the communication device 1300 further includes a memory 1330 for storing instructions. The processor 1310 is coupled to the memory and is configured to execute the instructions stored in the memory to control the transceiver 1320 to send and / or receive signals.

[0651] It should be understood that the processor 1310 and memory 1330 may be combined into a processing device, and the processor 1310 is used to execute the program code stored in the memory 1330 to implement the above functions. In specific implementations, the memory 1330 may also be integrated into the processor 1310 or independent of the processor 1310.

[0652] It should also be understood that the transceiver 1320 may include a receiver (or receiver) and a transmitter (or transmitter). The transceiver 720 may further include an antenna, and the number of antennas may be one or more. The transceiver 1320 may also be a communication interface or interface circuit.

[0653] When the communication device 1300 is a chip, the chip includes a transceiver unit and a processing unit. The transceiver unit may be an input / output circuit or a communication interface; and the processing unit may be a processor, microprocessor, or integrated circuit integrated on the chip.

[0654] The present application also provides a processing device including a processor and an interface. The processor can implement the method in the above method embodiment.

[0655] It should be understood that the processing device may be a chip. For example, the processing device may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD), or other integrated chips.

[0656] During implementation, each step of the above method can be completed by an integrated logic circuit of the hardware in the processor or by instructions in the form of software. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in conjunction with its hardware. To avoid repetition, it will not be described in detail here.

[0657] Figure 14 is another schematic structural diagram of a communication device provided in an embodiment of the present application. As shown in Figure 14, the device 1400 includes a processing circuit 1410, which is configured to execute instructions to implement the functions of the terminal device in the methods shown in Figures 5 to 11 above, or to implement the functions of the network device in the methods shown in Figures 5 to 11 above.

[0658] Optionally, the apparatus 1400 may further include a transceiver circuit 1420. The processing circuit 1410 and the transceiver circuit 1420 communicate with each other via an internal connection path, and the processing circuit 1410 may control the transceiver circuit 1420 to send and / or receive signals.

[0659] Optionally, the apparatus 1400 may further include a storage medium 1430, which communicates with the processing circuit 1410 and the transceiver circuit 1420 via an internal connection path. The storage medium 1430 is used to store instructions, and the processing circuit 1410 may execute the instructions stored in the storage medium 1430.

[0660] In one possible implementation, the apparatus 1400 is used to implement the process corresponding to the terminal device in the above method embodiment.

[0661] In another possible implementation, the apparatus 1400 is used to implement the process corresponding to the network device in the above method embodiment.

[0662] According to the method provided in the embodiment of the present application, the present application also provides a computer program product, which includes instructions. When the instructions are executed by the processor, the functions of the terminal device in the method shown in Figures 5 to 11 above are implemented, or the functions of the network device in the method shown in Figures 5 to 11 above are implemented.

[0663] According to the method provided in an embodiment of the present application, the present application also provides a computer-readable storage medium, which includes instructions. When the instructions are executed by a processor, the functions of the terminal device in the method shown in Figures 5 to 11 above are implemented, or the functions of the network device in the method shown in Figures 5 to 11 above are implemented.

[0664] According to the method provided in the embodiment of the present application, the present application also provides a system, which includes one or more terminal devices and one or more network devices as mentioned above.

[0665] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may 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 may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a high-density digital video disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).

[0666] In the embodiments of this application, words such as "exemplary" and "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of the word "exemplary" is intended to present concepts in a concrete way.

[0667] It should be understood that references to "embodiments" throughout this specification mean that a particular feature, structure, or characteristic associated with the embodiment is included in at least one embodiment of the present application. Therefore, various embodiments throughout this specification do not necessarily refer to the same embodiment. Furthermore, these particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0668] It should be understood that in the 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. The names of all nodes and messages in this application are merely names set by this application for the convenience of description. The names in the actual network may be different. It should not be understood that this application limits the names of various nodes and messages. On the contrary, any name with the same or similar function as the node or message used in this application is regarded as the method or equivalent replacement of this application, and is within the scope of protection of this application.

[0669] It should also be understood that in this application, "when", "if" and "if" all mean that the UE or base station will take corresponding measures under certain objective circumstances. It does not limit the time, and does not require the UE or base station to take judgment actions when implementing it, nor does it mean that there are other limitations.

[0670] It should be noted that in the embodiments of the present application, "pre-setting", "pre-configuration", etc. can be achieved by pre-saving corresponding codes, tables or other methods that can be used to indicate relevant information in a device (for example, a terminal device). This application does not limit its specific implementation method, such as the preset rules, preset constants, etc. in the embodiments of the present application.

[0671] Additionally, the terms "system" and "network" are often used interchangeably. The term "and / or" is simply used to describe an association between related objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone.

[0672] As used herein, the term "at least one of" or "at least one of" refers to all or any combination of the listed items. For example, "at least one of A, B, and C" or "at least one of A, B, or C" can refer to the following six situations: A alone, B alone, C alone, A and B together, B and C together, and A, B, and C together. As used herein, "at least one" means one or more. "A plurality" means two or more.

[0673] It should be understood that in the various embodiments of the present application, "B corresponding to A" means that B is associated with A and can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B solely based on A; B can also be determined based on A and / or other information. The terms "include," "comprising," "having," and their variations all mean "including but not limited to," unless otherwise specifically emphasized.

[0674] It should be understood that in various embodiments of the present application, the first, second, and various numerical numbers are merely distinctions for ease of description and are not intended to limit the scope of the embodiments of the present application.

[0675] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0676] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0677] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0678] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0679] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0680] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0681] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A communication method, characterized in that: The method comprises: deriving a first key, wherein the first key is determined based on a second key and using a first parameter value, the second key is a primary key, and the first parameter value is updated based on the second parameter value, or the first parameter value is determined based on a number of accesses to a first cell or a secondary station to which the first cell belongs; A third key is derived based on the first key, where the third key is a user plane key and / or a control plane key, and the third key is used to encrypt or protect data integrity of data and / or signaling between the first cell.

2. The method according to claim 1, characterized in that The second parameter value is a parameter value last used by the first cell or a secondary station to which the first cell belongs, or the second parameter value is a parameter value used in the last access.

3. The method according to claim 1, characterized in that The second parameter value is a parameter value used when the third cell was last accessed, and the third cell has the same second parameter as the first cell.

4. The method according to claim 3, characterized in that The deriving of the first key comprises: The first key is derived in case of a handover from a cell having a different second parameter value to the first cell.

5. The method according to claim 1, wherein The second parameter value is a parameter value last used by a cell in a first cell set, where the first cell set includes the first cell.

6. The method according to claim 5, characterized in that The deriving of the first key comprises: The first key is derived in case of a handover from a cell outside the first set of cells to the first cell.

7. The method according to any one of claims 1 to 6, characterized in that The first parameter value is the second parameter value plus N, where N is an integer greater than or equal to 1, or N is the maximum number of candidate cells added or changed in the conditional cell.

8. The method according to any one of claims 1 to 6, characterized in that The first parameter value is determined according to a third parameter value and the number of times of accessing the first cell or the secondary station to which the first cell belongs, and the third parameter value is a starting parameter value associated with the first cell or the secondary station to which the first cell belongs; or The first parameter value is determined according to the third parameter value and the number of times a cell accesses the first cell set, and the third parameter value is a starting parameter value associated with the first cell set.

9. The method according to any one of claims 1 to 6, characterized in that The first parameter value is the Pth value in a first set, where P is related to the number of accesses to the first cell or the secondary station to which the first cell belongs, and the first set includes multiple parameter values ​​associated with the first cell or the secondary station to which the first cell belongs.

10. The method according to any one of claims 1 to 9, characterized in that The method further comprises: The first message is sent to the primary station, where the first message indicates a first cell that meets the execution condition or a secondary station to which the first cell belongs, and the first message includes the first parameter value.

11. A communication method, characterized in that: The method comprises: deriving a first key, wherein the first key is based on a second key and is determined using a first parameter value, the second key being a master key, the first parameter value belonging to a third set, the third set including multiple parameter values ​​associated with a first set of cells, the first set of cells including the first cell; A third key is derived based on the first key, where the third key is a user plane key and / or a control plane key, and the third key is used to encrypt or protect data integrity of data and / or signaling between the first cell.

12. The method according to claim 11, characterized in that The first parameter value is randomly selected from a plurality of parameter values ​​included in the third set.

13. The method according to claim 11, characterized in that The first parameter value is the Pth value in the third set, where P is related to the number of times the first cell set is accessed.

14. The method according to any one of claims 11 to 13, characterized in that The first parameter value is deleted from the third set.

15. The method according to any one of claims 11 to 14, characterized in that The deriving of the first key comprises: The first key is derived in case of a handover from a cell outside the first set of cells to the first cell.

16. A method of communication, characterized in that: The method comprises: Deriving a first key, wherein the first key is used for security of the first cell, the first cell is a candidate cell for adding or changing CPAC for a conditional cell, the first key is determined based on a second key and using a first parameter value, the second key is a primary key, the first parameter value is received from a terminal device, or the first parameter value is updated based on the second parameter value, or the first parameter value is determined based on the number of times the terminal device accesses the first cell or a secondary station to which the first cell belongs; The first key is sent to the first cell or a secondary station to which the first cell belongs.

17. The method according to claim 16, characterized in that The sending the first key to the first cell or a secondary station to which the first cell belongs includes: A second set is sent to the first cell or a secondary station to which the first cell belongs, where the second set includes multiple keys associated with the first cell or the secondary station to which the first cell belongs, and the multiple keys include the first key.

18. The method according to claim 16 or 17, characterized in that The method further comprises: A first message is received from the terminal device, where the first message includes the first parameter value, and the first message indicates a first cell that meets an execution condition or a secondary station to which the first cell belongs.

19. The method according to any one of claims 16 to 18, characterized in that The second parameter value is a parameter value last used by the first cell or the secondary station to which the first cell belongs, or the second parameter value is a parameter value last used by the terminal device for access.

20. The method according to any one of claims 16 to 18, characterized in that The second parameter value is a parameter value used when the third cell was last accessed, and the third cell has the same second parameter as the first cell.

21. The method according to claim 20, characterized in that The deriving of the first key comprises: The first key is derived in case of a handover from a cell having a different second parameter value to the first cell.

22. The method according to any one of claims 16 to 18, characterized in that The second parameter value is a parameter value last used by a cell in a first cell set, where the first cell set includes the first cell.

23. The method according to claim 22, characterized in that The deriving of the first key comprises: The first key is derived in case of a handover from a cell outside the first set of cells to the first cell.

24. The method according to any one of claims 16 to 23, characterized in that The first parameter value is the second parameter value plus N, where N is an integer greater than or equal to 1, or N is the maximum number of candidate cells added or changed in the conditional cell.

25. The method according to any one of claims 16 to 23, characterized in that The first parameter value is determined according to a third parameter value and the number of times the terminal device accesses the first cell or the secondary station to which the first cell belongs, wherein the third parameter value is a starting parameter value associated with the first cell or the secondary station to which the first cell belongs; or The first parameter value is determined according to the third parameter value and the number of times a cell accesses the first cell set, and the third parameter value is a starting parameter value associated with the first cell set.

26. The method according to any one of claims 16 to 23, characterized in that The first parameter value is the Pth value in the first set, where P is related to the number of times the terminal device accesses the first cell or the secondary station to which the first cell belongs, and the first set includes multiple parameter values ​​associated with the first cell or the secondary station to which the first cell belongs.

27. A method of communication, characterized in that: The method comprises: receiving a second set, where the second set includes multiple keys associated with a first cell or a secondary station to which the first cell belongs, the multiple keys including the first key; The first key is determined from the second set according to the first identifier or the number of times the terminal device accesses the first cell or the secondary station to which the first cell belongs, and the first identifier is used to indicate the position of the first key in the second set.

28. The method according to claim 27, characterized in that The method further comprises: A second message is received, where the second message includes the first identifier.

29. A method of communication, characterized in that The method comprises: deriving a fourth key, wherein the fourth key is determined based on a fifth key, the fifth key is a key of a last accessed cell, or the fifth key is a key used for a last access to a second cell or a secondary station to which the second cell belongs, or the fifth key is a key last used by a cell in a second cell set, and the first cell set includes the second cell, or the fifth key is a key used for a last access to a fourth cell, and the fourth cell has the same key or the same count value as the second cell; A sixth key is derived according to the fourth key, the sixth key being a user plane key and / or a control plane key. for encrypting or protecting data integrity of data and / or signaling between the second cell and the second cell.

30. The method according to claim 29, wherein The deriving of the fourth key comprises: The fourth key is derived in case of a handover from a cell outside the second set of cells to the second cell, or in case of a handover from a cell with a different count value to the second cell.

31. The method according to claim 29 or 30, characterized in that The fourth key is determined based on the fifth key, including: The fourth key is derived based on the fifth key and using a fourth parameter value.

32. The method according to claim 31, characterized in that The fourth parameter value is a parameter value associated with the second cell or the secondary station to which the second cell belongs, or the fourth parameter value is a parameter value associated with the second cell set, or the fourth parameter value is updated based on the fifth parameter value, or the fourth parameter value is determined according to the number of accesses to the second cell or the secondary station to which the second cell belongs.

33. The method according to claim 32, characterized in that The fifth parameter value is the parameter value last used by the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is the parameter value last used by the last access, or the fifth parameter value is the parameter value last used by a cell in the second cell set.

34. A method of communication, characterized in that The method comprises: deriving a fourth key, where the fourth key is used for security of the second cell, the fourth key is determined based on a fifth key, the fifth key is a key for a previous cell accessed, or the fifth key is a key used for a previous access to the second cell or a secondary station to which the second cell belongs; The fourth key is sent to the second cell or a secondary station to which the second cell belongs.

35. A method of communication, characterized in that The method comprises: deriving a fourth key, wherein the fourth key is used for security of the second cell, the fourth key is determined based on a fifth key, the fifth key is a key used for a last access to the second cell or access to a secondary station to which the second cell belongs, or the fifth key is a key last used by a cell in a second cell set, the first cell set includes the second cell, or the fifth key is a key last used by a fourth cell for a last access, and the fourth cell has the same key or the same count value as the second cell; A sixth key is derived based on the fourth key, where the sixth key is a user plane key and / or a control plane key, and the sixth key is used to encrypt or protect data integrity of data and / or signaling between the terminal device.

36. The method according to claim 34 or 35, characterized in that The fourth key is determined based on the fifth key, including: The fourth key is derived based on the fifth key and using a fourth parameter value, where the fourth parameter value is a parameter value associated with the second cell or a secondary station accessing the second cell, or the fourth parameter value is a parameter value associated with the second cell set.

37. The method according to any one of claims 34 to 36, characterized in that The fifth key is determined based on the sixth key and using the fifth parameter value, the sixth key is the master key, the fifth parameter value is the parameter value associated with the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is updated based on the sixth parameter value, or the fifth parameter value is determined according to the number of times the terminal device accesses the second cell or the secondary station to which the second cell belongs, or the fifth parameter value is the parameter value last used by the cell in the second cell set.

38. The method according to claim 37, wherein The sixth parameter value is a parameter value last used by the second cell or the secondary station to which the second cell belongs, or the sixth parameter value is a parameter value last used by the terminal device for access.

39. A communication device, characterized in that: include: A unit or module for performing the method according to any one of claims 1 to 10, or a unit or module for performing the method according to any one of claims 11 to 15, or a unit or module for performing the method according to any one of claims 29 to 33; or a unit or module for performing the method according to any one of claims 16 to 26, or a unit or module for performing the method according to any one of claims 34 and claims 35 to 38; or a unit or module for performing the method according to claim 27 or 28.

40. A communication device, characterized in that: The communication device includes a processor and a storage medium, the storage medium storing instructions, and when the instructions are executed by the processor, the method according to any one of claims 1 to 10 is implemented, or the method according to any one of claims 11 to 15 is implemented, or the method according to any one of claims 29 to 33 is implemented; or the method according to any one of claims 16 to 26 is implemented, or the method according to any one of claims 34 and claims 35 to 38 is implemented; or the method according to claim 27 or 28 is implemented.

41. A computer-readable storage medium, characterized in that The computer-readable storage medium includes instructions that, when executed by a processor, enable the method according to any one of claims 1 to 10 to be implemented, or enable the method according to any one of claims 11 to 15 to be implemented, or enable the method according to any one of claims 29 to 33 to be implemented; or enable the method according to any one of claims 16 to 26 to be implemented, or enable the method according to any one of claims 34 and claims 35 to 38 to be implemented; or enable the method according to claim 27 or 28 to be implemented.

42. A computer program product, characterized in that The computer program product includes instructions that, when executed by a processor, enable the method according to any one of claims 1 to 10 to be implemented, or enable the method according to any one of claims 11 to 15 to be implemented, or enable the method according to any one of claims 29 to 33 to be implemented; or enable the method according to any one of claims 16 to 26 to be implemented, or enable the method according to any one of claims 34 and claims 35 to 38 to be implemented; or enable the method according to claim 27 or 28 to be implemented.

43. A communication method, characterized in that: The communication method includes: a method according to any one of claims 1 to 10, a method according to any one of claims 11 to 15, a method according to any one of claims 16 to 26, and a method according to claim 27 or 28; or a method according to any one of claims 29 to 33, a method according to any one of claims 34 and claims 35 to 38.

44. A communication system, characterized in that The communication system includes: a unit or module for executing the method according to any one of claims 1 to 10, a unit or module for executing the method according to any one of claims 11 to 15, a unit or module for executing the method according to any one of claims 16 to 26, and a unit or module for executing the method according to claim 27 or 28; or a unit or module for executing the method according to any one of claims 29 to 33, and a unit or module for executing the method according to any one of claims 34 and claims 35 to 38.