(19)
(11)EP 3 648 492 A1

(12)EUROPEAN PATENT APPLICATION
published in accordance with Art. 153(4) EPC

(43)Date of publication:
06.05.2020 Bulletin 2020/19

(21)Application number: 17919375.0

(22)Date of filing:  27.07.2017
(51)Int. Cl.: 
H04W 12/04  (2009.01)
H04W 36/00  (2009.01)
H04W 36/08  (2009.01)
(86)International application number:
PCT/CN2017/094766
(87)International publication number:
WO 2019/019121 (31.01.2019 Gazette  2019/05)
(84)Designated Contracting States:
AL AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HR HU IE IS IT LI LT LU LV MC MK MT NL NO PL PT RO RS SE SI SK SM TR
Designated Extension States:
BA ME
Designated Validation States:
MA MD

(71)Applicant: Huawei Technologies Co., Ltd.
Longgang Shenzhen, Guangdong 518129 (CN)

(72)Inventor:
  • ZENG, Xin
    Shenzhen Guangdong 518129 (CN)

(74)Representative: Epping - Hermann - Fischer 
Patentanwaltsgesellschaft mbH Schloßschmidstraße 5
80639 München
80639 München (DE)


(56)References cited: : 
  
      


    (54)CELL SWITCHING METHOD AND DEVICE


    (57) Embodiments of this application provide an inter-cell handover method and apparatus, to help improve inter-cell handover security. The method includes: obtaining, by a source cell, a key retention policy of a terminal device, where the source cell and the terminal device use a first key to communicate with each other; determining, by the source cell according to the key retention policy of the terminal device and a key retention policy of the source cell, whether the terminal device and a target cell use the first key to communicate with each other; and sending, by the source cell, a handover request message to the target cell, where the handover request message is used to request to hand over the terminal device from the source cell to the target cell, the handover request message includes first indication information, and the first indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other.




    Description

    TECHNICAL FIELD



    [0001] Embodiments of this application relate to the communications field, and more specifically, to an inter-cell handover method and apparatus.

    BACKGROUND



    [0002] In consideration of information security, in a process of communication between a terminal device and a cell that the terminal device accesses, a key is used to encrypt data to be transmitted. If inter-cell handover occurs, for example, the terminal device is handed over from a source cell to a target cell, whether the terminal device and the target cell can use an original key (that is, a key used for communication between the terminal device and the source cell before handover) to communicate with each other needs to be considered. This is because that key updating is unnecessary in some scenarios, and instead key updating leads to some adverse effects. For example, in an intra-cell handover scenario or in a scenario in which handover is performed within one central unit (center unit, CU), the terminal device is located within a same secure area before and after handover is performed, especially in the case of intra-cell handover; and if a key is updated, some data is encrypted by using the original key and is sent from the source cell, but the terminal device already accesses the target cell, and the terminal device needs to decrypt the data and uses a new key to encrypt and send the data in the target cell. As a result, a data sending delay is increased.

    [0003] In the existing inter-cell handover procedure, the terminal device, the source cell, and the target cell all may determine whether to retain the original key. When the terminal device, the source cell, and the target cell all determine that the original key can be retained, the terminal device and the target cell can use the original key to communicate with each other, or otherwise, a new key needs to be generated, and the terminal device and the target cell use the new key to communicate with each other. However, when the source cell determines to retain the original key, the target cell determines to retain the original key, and the terminal device determines to update the key, the target cell generates the new key only after receiving indication information, sent by the terminal device, used to indicate whether to retain the original key. Before both the target cell and the terminal device generate the new key, a message used for communication between the terminal device and the target cell is protected by using the original key, causing a relatively high security risk.

    SUMMARY



    [0004] Embodiments of this application provide an inter-cell handover method and apparatus, to help improve inter-cell handover security.

    [0005] According to a first aspect, an inter-cell handover method is provided. The method includes: obtaining, by a source cell, a key retention policy of a terminal device, where the source cell and the terminal device use a first key to communicate with each other, and the key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key; determining, by the source cell according to the key retention policy of the terminal device and a key retention policy of the source cell, whether the terminal device and a target cell use the first key to communicate with each other, where the key retention policy of the source cell is used to indicate a condition for the source cell to determine to retain the first key; and sending, by the source cell, a handover request message to the target cell, where the handover request message is used to request to hand over the terminal device from the source cell to the target cell, the handover request message includes first indication information, and the first indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other.

    [0006] It should be understood that the key retention policy may be preconfigured. The key retention policy of the source cell may be whether to forcibly change a key, whether to retain an original key when the source cell and the target cell are corresponding to one network element, or the like. The key retention policy of the terminal device may be that a key needs to be changed when handover is performed between heterogeneous cells, that a key needs to be changed when use duration of the original key exceeds a first threshold, or the like. A key retention policy of the target cell may be whether to forcibly change a key, whether to retain an original key when the source cell and the target cell are corresponding to one network element, or the like. This is not limited in this embodiment of this application.

    [0007] According to the inter-cell handover method in this embodiment of this application, the source cell obtains the key retention policy of the terminal device in advance, that is, the key retention policy of the terminal device is considered in advance. The target cell can determine, before communicating with the terminal device, whether to retain the original key finally. This resolves the following problem resulting from that decision of the terminal device lags behind decision of the target cell: Information sent by the terminal device and the target cell is protected still by using the original key when the key is updated. Therefore, when it is determined that the key is updated, the target cell can use a new key to communicate with the terminal device, thereby helping improve inter-cell handover security.

    [0008] In a first possible implementation of the first aspect, when the source cell determines that the terminal device and the target cell use the first key to communicate with each other, the handover request message further includes the first key, a second key, and a next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell.

    [0009] Specifically, when the source cell determines to retain the first key, the source cell may add the first key and the second key to the handover request message, and send the handover request message to the target cell. The second key is a backup key generated by the source cell. If the target cell determines to retain the first key, the target cell may directly communicate with the terminal device based on the received first key. If the target cell determines not to retain the first key, the target cell may directly communicate with the terminal device based on the received second key.

    [0010] In this way, the target cell may directly use the key sent by the source cell, thereby avoiding the following case resulting from that a key derivation algorithm of the target cell is different from a key derivation algorithm of the terminal device: After the terminal device accesses the target cell, a key used by the target cell is inconsistent with a key used by the terminal device.

    [0011] With reference to the foregoing possible implementation of the first aspect, in a second possible implementation of the first aspect, the handover request message further includes use duration information of the first key.

    [0012] Therefore, when the source cell determines to retain the first key, the source cell sends the use duration information of the first key to the target cell, so that a problem of insecurity resulting from that the first key is not changed for a long time can be avoided.

    [0013] It should be understood that, the use duration information of the first key may be a quantity of seconds for which the first key is used, or a quantity of packet data convergence protocol (packet data convergence protocol, PDCP) packets of which encryption and decryption are implemented by using the first key. This is not limited in this embodiment of this application.

    [0014] With reference to the possible implementation of the first aspect, in a third possible implementation of the first aspect, when the source cell determines that the terminal device and the target cell do not use the first key to communicate with each other, the handover request message further includes a second key and a next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell.

    [0015] Specifically, when the source cell determines not to retain the first key, the source cell may directly add the second key to the handover request message, and send the handover request message to the target cell; and after receiving the second key, the target cell may directly use the second key to communicate with the terminal device.

    [0016] It should be understood that, the second key may be generated by the source cell according to a key derivation algorithm that is agreed on between the source cell and the terminal device, or may be preconfigured. After generating the second key, the source cell may send the second key to both the target cell and the terminal device; or after generating the second key, the source cell may send the second key only to the target cell, and the terminal device itself generates the second key. This is not limited in this embodiment of this application.

    [0017] With reference to the foregoing possible implementations of the first aspect, in a fourth possible implementation of the first aspect, the obtaining, by a source cell, a key retention policy of a terminal device includes: receiving, by the source cell, the key retention policy of the terminal device sent by a core network device; or receiving, by the source cell, the key retention policy of the terminal device sent by the terminal device.

    [0018] With reference to the foregoing possible implementations of the first aspect, in a fifth possible implementation of the first aspect, the method further includes: receiving, by the source cell, a handover response message sent by the target cell, where the handover response message includes second indication information, and the second indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other; and sending, by the source cell, a radio resource control RRC connection reconfiguration message to the terminal device, where the RRC connection reconfiguration message includes the second indication information.

    [0019] When the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the RRC connection reconfiguration message further includes the NCC of the second key.

    [0020] Specifically, after the source cell sends the handover request message to the target cell, the source cell receives the handover response message sent by the target cell. The handover response message carries the second indication information used to indicate whether to retain the first key. The second indication information includes the key retention policy of the terminal device, the key retention policy of the source cell, and the key retention policy of the target cell. Therefore, the source cell may directly and transparently transfer the second indication information to the terminal device, notify the terminal device of a final decision, and send the NCC to the terminal device when the source cell uses the second key, so that the terminal device generates the finally used second key, to ensure that the terminal device and the target cell use the same key to communicate with each other.

    [0021] According to a second aspect, another inter-cell handover method is provided. The method includes: receiving, by a target cell, a handover request message sent by a source cell, where the handover request message is used to request to hand over a terminal device from the source cell to the target cell, the handover request message includes first indication information, the first indication information is used to indicate whether the terminal device and the target cell use a first key to communicate with each other, the source cell and the terminal device use the first key to communicate with each other, the first indication information is determined by the source cell according to a key retention policy of the terminal device and a key retention policy of the source cell, the key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key, and the key retention policy of the source cell is used to indicate a condition for the source cell to determine to retain the first key; and determining, by the target cell according to the first indication information and a key retention policy of the target cell, whether to use the first key to communicate with the terminal device, where the key retention policy of the target cell is used to indicate a condition for the target cell to determine to retain the first key.

    [0022] According to the inter-cell handover method in this embodiment of this application, the source cell obtains the key retention policy of the terminal device in advance, that is, the key retention policy of the terminal device is considered in advance. The target cell can determine, before communicating with the terminal device, whether to retain the original key finally. This resolves the following problem resulting from that decision of the terminal device lags behind decision of the target cell: Information sent by the terminal device and the target cell is protected still by using the original key when the key is updated. Therefore, when it is determined that the key is updated, the target cell can use a new key to communicate with the terminal device, thereby helping improve inter-cell handover security.

    [0023] In a first possible implementation of the second aspect, when the first indication information indicates that the terminal device and the target cell use the first key to communicate with each other, the handover request message further includes the first key, a second key, and a next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell. The method further includes: when the target cell determines not to use the first key to communicate with the terminal device, determining, by the target cell, to use the second key to communicate with the terminal device.

    [0024] With reference to the foregoing possible implementation of the second aspect, in a second possible implementation of the second aspect, the handover request message further includes use duration information of the first key; and the determining, by the target cell according to the first indication information and a key retention policy of the target cell, whether to use the first key to communicate with the terminal device includes: determining, by the target cell according to the key retention policy of the target cell and the use duration information of the first key, whether to use the first key to communicate with the terminal device.

    [0025] With reference to the foregoing possible implementations of the second aspect, in a third possible implementation of the second aspect, after the determining, by the target cell, whether to use the first key to communicate with the terminal device, the method further includes: sending, by the target cell, a handover response message to the source cell, where the handover response message includes second indication information, and the second indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other.

    [0026] When the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the handover response message further includes the NCC of the second key.

    [0027] According to a third aspect, another inter-cell handover method is provided. The method includes: receiving, by a terminal device, a radio resource control RRC connection reconfiguration message sent by a source cell, where the RRC connection reconfiguration message includes second indication information, the second indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other, and the first key is a key used for communication between the source cell and the terminal device; and when the second indication information is used to indicate that the terminal device and the target cell do not use the first key to communicate with each other, determining, by the terminal device, to use a second key to communicate with the target cell, where the second key is a backup key used for communication between the terminal device and the target cell.

    [0028] In a first possible implementation of the third aspect, the method further includes: when the second indication information is used to indicate that the terminal device and the target cell use the first key to communicate with each other, determining, by the terminal device, to use the first key to communicate with the target cell.

    [0029] With reference to the foregoing possible implementation of the third aspect, in a second possible implementation of the third aspect, when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the RRC connection reconfiguration message further includes the NCC. The method further includes: generating, by the terminal device, the second key based on the NCC.

    [0030] It should be understood that, when the second indication information indicates that the terminal device and the target cell use the first key to communicate with each other, the terminal device can still use the original first key, with no need to generate a new key based on the NCC.

    [0031] With reference to the foregoing possible implementations of the third aspect, in a third possible implementation of the third aspect, before the receiving, by the terminal device, a radio resource control RRC connection configuration message sent by a source cell, the method further includes: sending, by the terminal device, a key retention policy of the terminal device to the source cell, where the key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key.

    [0032] According to a fourth aspect, an inter-cell handover apparatus is provided, configured to perform the method in the first aspect or any possible implementation of the first aspect. Specifically, the apparatus includes units configured to perform the method in the first aspect or any possible implementation of the first aspect.

    [0033] According to a fifth aspect, an inter-cell handover apparatus is provided, configured to perform the method in the second aspect or any possible implementation of the second aspect. Specifically, the apparatus includes units configured to perform the method in the second aspect or any possible implementation of the second aspect.

    [0034] According to a sixth aspect, an inter-cell handover apparatus is provided, configured to perform the method in the third aspect or any possible implementation of the third aspect. Specifically, the apparatus includes units configured to perform the method in the third aspect or any possible implementation of the third aspect.

    [0035] According to a seventh aspect, an inter-cell handover apparatus is provided. The apparatus includes a transceiver, a memory, and a processor. The transceiver, the memory, and the processor communicate with each other through an internal connection channel. The memory is configured to store an instruction. The processor is configured to execute the instruction stored in the memory, to control a receiver to receive a signal, and control a transmitter to send a signal. When the processor executes the instruction stored in the memory, the execution makes the processor perform the method in the first aspect or any possible implementation of the first aspect.

    [0036] According to an eighth aspect, an inter-cell handover apparatus is provided. The apparatus includes a transceiver, a memory, and a processor. The transceiver, the memory, and the processor communicate with each other through an internal connection channel. The memory is configured to store an instruction. The processor is configured to execute the instruction stored in the memory, to control a receiver to receive a signal, and control a transmitter to send a signal. When the processor executes the instruction stored in the memory, the execution makes the processor perform the method in the second aspect or any possible implementation of the second aspect.

    [0037] According to a ninth aspect, an inter-cell handover apparatus is provided. The apparatus includes a transceiver, a memory, and a processor. The transceiver, the memory, and the processor communicate with each other through an internal connection channel. The memory is configured to store an instruction. The processor is configured to execute the instruction stored in the memory, to control a receiver to receive a signal, and control a transmitter to send a signal. When the processor executes the instruction stored in the memory, the execution makes the processor perform the method in the third aspect or any possible implementation of the third aspect.

    [0038] According to a tenth aspect, a computer program product is provided. The computer program product includes computer program code. When the computer program code is run by a source cell, the source cell is enabled to perform the method in the first aspect or any possible implementation of the first aspect.

    [0039] According to an eleventh aspect, a computer program product is provided. The computer program product includes computer program code. When the computer program code is run by a target cell, the target cell is enabled to perform the method in the second aspect or any possible implementation of the second aspect.

    [0040] According to a twelfth aspect, a computer program product is provided. The computer program product includes computer program code. When the computer program code is run by a terminal device, the terminal device is enabled to perform the method in the third aspect or any possible implementation of the third aspect.

    [0041] According to a thirteenth aspect, a computer-readable medium is provided, where the computer-readable medium is configured to store a computer program. The computer program includes an instruction used to perform the method in the first aspect or any possible implementation of the first aspect.

    [0042] According to a fourteenth aspect, a computer-readable medium is provided, where the computer-readable medium is configured to store a computer program. The computer program includes an instruction used to perform the method in the second aspect or any possible implementation of the second aspect.

    [0043] According to a fifteenth aspect, a computer-readable medium is provided, where the computer-readable medium is configured to store a computer program. The computer program includes an instruction used to perform the method in the third aspect or any possible implementation of the third aspect.

    DESCRIPTION OF DRAWINGS



    [0044] 

    FIG 1 is a schematic diagram of a communications system according to an embodiment of this application;

    FIG 2 is a schematic flowchart of an inter-cell handover method according to an embodiment of this application;

    FIG 3 is a schematic flowchart of another inter-cell handover method according to an embodiment of this application;

    FIG 4 is a schematic flowchart of another inter-cell handover method according to an embodiment of this application;

    FIG 5 is a schematic flowchart of another inter-cell handover method according to an embodiment of this application;

    FIG 6 is a schematic block diagram of an inter-cell handover apparatus according to an embodiment of this application;

    FIG 7 is a schematic block diagram of another inter-cell handover apparatus according to an embodiment of this application;

    FIG 8 is a schematic block diagram of another inter-cell handover apparatus according to an embodiment of this application;

    FIG 9 is a schematic block diagram of another inter-cell handover apparatus according to an embodiment of this application;

    FIG 10 is a schematic block diagram of another inter-cell handover apparatus according to an embodiment of this application; and

    FIG 11 is a schematic block diagram of another inter-cell handover apparatus according to an embodiment of this application.


    DESCRIPTION OF EMBODIMENTS



    [0045] The following describes the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application.

    [0046] The technical solutions of the embodiments of this application may be applied to various communications systems, such as a global system for mobile communications (global system of mobile communication, GSM) system, a code division multiple access (code division multiple access, CDMA) system, a wideband code division multiple access (wideband code division multiple access, WCDMA) system, a general packet radio service (general packet radio service, GPRS) system, a long term evolution (long term evolution, LTE) system, an LTE frequency division duplex (frequency division duplex, FDD) system, an LTE time division duplex (time division duplex, TDD) system, a universal mobile telecommunications system (universal mobile telecommunication system, UMTS), a worldwide interoperability for microwave access (worldwide interoperability for microwave access, WiMAX) communications system, and a future 5G system.

    [0047] FIG 1 shows a communications system 100 applied to an embodiment of this application. The communications system 100 may include at least two network devices 110. The network device 110 may be a device that communicates with a terminal device, for example, a base station or a base station controller. Each network device 110 may provide communication coverage to a particular geographical area, and may communicate with a terminal device (for example, UE) located within this coverage area (a cell). The network device 110 may be a base transceiver station (base transceiver station, BTS) in a GSM system, a code division multiple access (code division multiple access, CDMA) system, a NodeB (node B, NB) in a WCDMA system, an evolved NodeB (evolutional node B, eNB or eNodeB) in an LTE system, or a radio controller in a cloud radio access network (cloud radio access network, CRAN). Alternatively, the network device may be a relay station, an access point, an in-vehicle device, a wearable device, a network-side device in a future 5G network, a network device in a future evolved public land mobile network (public land mobile network, PLMN), or the like.

    [0048] The wireless communications system 100 further includes at least one terminal device 120 located within a coverage area of the network device 110. The terminal device 120 may be mobile or fixed. The terminal device 120 may be an access terminal, user equipment (user equipment, UE), a subscriber unit, a subscriber station, a mobile station, a mobile console, a remote station, a remote terminal, a mobile device, a user terminal, a terminal, a wireless communications device, a user agent, or a user apparatus. The access terminal may be a cellular phone, a cordless phone, a session initiation protocol (session initiation protocol, SIP) phone, a wireless local loop (wireless local loop, WLL) station, a personal digital assistant (personal digital assistant, PDA), a handheld device having a wireless communication function, a computing device or another processing device connected to a wireless modem, an in-vehicle device, a wearable device, a terminal device in a future 5G network, or a terminal device in a future evolved public land mobile network (public land mobile network, PLMN), or the like.

    [0049] FIG 1 shows an example in which there are two network devices and one terminal device. Optionally, the communications system 100 may include a plurality of network devices, and another quantity of terminal devices may be included within a coverage area of each network device. This is not limited in this embodiment of this application.

    [0050] Optionally, the wireless communications system 100 may further include a network controller, a mobility management entity, and another network entity. This embodiment of this application is not limited thereto.

    [0051] In consideration of information security, in a process of communication between a terminal device and a cell that the terminal device accesses, a key is used to encrypt data to be transmitted. If inter-cell handover occurs, for example, the terminal device is handed over from a source cell to a target cell, whether the terminal device and the target cell can use an original key (that is, a key used for communication between the terminal device and the source cell before handover) to communicate with each other needs to be considered.

    [0052] Considering that the target cell may be an area with a relatively strict requirement on security, for example, a government area, the key needs to be forcibly updated for such type of cell. Therefore, the terminal device, the source cell, and the target cell all may determine whether to retain the original key. When the terminal device, the source cell, and the target cell all are allowed to retain the original key, the terminal device and the target cell can use the original key to communicate with each other, or otherwise, a new key needs to be generated, and the terminal device and the target cell use the new key to communicate with each other. In the existing handover procedure, the source cell first needs to add, to a handover request message, a decision whether the source cell retains the original key, and send the handover request message to the target cell. Then the target cell sends a handover response message to the source cell based on a decision of the target cell, where the handover response message carries indication information used to indicate whether to retain the original key. The source cell sends the indication information to the terminal device, and the terminal device sends, to the target cell based on a decision of the terminal device, the indication information used to indicate whether to retain the original key.

    [0053] When the source cell determines to retain the original key, the target cell determines to retain the original key, and the terminal device determines to update the key, the target cell generates the new key only after receiving the indication information, sent by the terminal device, used to indicate whether to retain the original key. Before both the target cell and the terminal device generate the new key, a message used for communication between the terminal device and the target cell is protected by using the original key, causing a relatively high security risk. Therefore, the embodiments of this application provide a new inter-cell handover method.

    [0054] It should be understood that, in the embodiments of this application, a cell may represent a coverage area of the network device 110, or may represent a coverage area of a sector of the network device 110. This is not limited in the embodiments of this application.

    [0055] For ease of understanding, the following uses an inter-cell handover procedure of one terminal device as an example to describe the embodiments of this application in details.

    [0056] FIG 2 is a schematic flowchart of an inter-cell handover method 200 according to an embodiment of this application. The method 200 may be applied to the communications system 100 shown in FIG 1. However, this embodiment of this application is not limited thereto.

    [0057] S210. A source cell obtains a key retention policy of a terminal device, where the source cell and the terminal device use a first key to communicate with each other, and the key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key.

    [0058] S220. The source cell determines, according to the key retention policy of the terminal device and a key retention policy of the source cell, whether the terminal device and a target cell use the first key to communicate with each other, where the key retention policy of the source cell is used to indicate a condition for the source cell to determine to retain the first key.

    [0059] S230. The source cell sends a handover request message to the target cell, where the handover request message is used to request to hand over the terminal device from the source cell to the target cell, the handover request message includes first indication information, and the first indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other.

    [0060] Specifically, the terminal device accesses the source cell, and the source cell and the terminal device use the first key to communicate with each other, where the first key is an original key. Because the terminal device is mobile, if the terminal device moves into a coverage area of the target cell, a connection of the terminal device needs to be handed over from the source cell to the target cell. Because the source cell, the terminal device, and the target cell all can determine whether to retain the first key, the source cell, the terminal device, and the target cell have respective key retention policies. It should be understood that the key retention policies may be preconfigured. The key retention policy of the source cell may be whether to forcibly change a key, whether to retain the original key when the source cell and the target cell are corresponding to one network element, or the like. The key retention policy of the terminal device may be that a key needs to be changed when handover is performed between heterogeneous cells, that a key needs to be changed when use duration of the original key exceeds a first threshold, or the like. A key retention policy of the target cell may be whether to forcibly change a key, whether to retain the original key when the source cell and the target cell are corresponding to one network element, or the like. This is not limited in this embodiment of this application.

    [0061] Before inter-cell handover is performed, the source cell may first obtain the key retention policy of the terminal device, and the source cell may determine, according to the key retention policy of the source cell and the key retention policy of the terminal device, whether to retain the first key, that is, determine whether to still use the first key for communication after the terminal device is handed over to the target cell. Then, the source cell may send the handover request message to the target cell, to request to hand over the terminal device from the source cell to the target cell, where the handover request message carries the first indication information used to indicate whether to retain the first key, in other words, the first indication information is used to indicate whether the terminal device and the target cell continue to use the first key to communicate with each other. In a possible implementation, the first indication information may be a one-bit indicator bit. For example, 0 represents that the original key continues to be used for communication, and 1 represents that the original key is not used for communication, that is, represents that the key need to be changed.

    [0062] After the target cell receives the handover request message sent by the source cell, if the first indication information in the handover request message is used to indicate that the first key is not retained, the target cell may directly determine that the key needs to be updated. If the first indication information in the handover request message is used to indicate that the first key is retained, the target cell may determine, according to the key retention policy of the target cell, whether to retain the first key. The target cell sends a handover response message to the source cell, where the handover response message carries second indication information used to indicate whether to retain the first key. The second indication information may be the same as the first indication information or may be different from the first indication information. This depends on the key retention measurement of the target cell. When the target cell determines to retain the first key, the source cell and the target cell perform inter-cell handover according to an existing inter-cell handover procedure. When the target cell determines not to retain the first key, the target cell and the terminal device may separately obtain a second key, so that the target cell and the terminal device use the second key to communicate with each other. The second key may be obtained in a plurality of manners. The second key may be generated by the source cell and is sent to the target cell and the terminal device, or the second key may be generated by each of the target cell and the terminal device. This is not limited in this embodiment of this application.

    [0063] In this embodiment of this application, the source cell obtains the key retention policy of the terminal device in advance, that is, the key retention policy of the terminal device is considered in advance. The target cell can determine, before communicating with the terminal device, whether to retain the original key finally. This resolves the following problem resulting from that decision of the terminal device lags behind decision of the target cell: Information sent by the terminal device and the target cell is protected still by using the original key when the key is updated.

    [0064] Therefore, according to the inter-cell handover method in this embodiment of this application, the decision of the terminal device is considered in advance, the source cell determines, according to the key retention policy of the source cell and the key retention policy of the terminal device, whether to retain the original key; and when it is determined to update the key, the target cell can use the new key to communicate with the terminal device, thereby helping improve inter-cell handover security.

    [0065] In an optional embodiment, when the source cell determines that the terminal device and the target cell use the first key to communicate with each other, the handover request message further includes the first key, a second key, and a next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell, and the second key is a backup key used for communication between the terminal device and the target cell.

    [0066] Specifically, when the source cell determines to retain the first key, the source cell may add the first key and the second key to the handover request message, and send the handover request message to the target cell. The second key is a backup key generated by the source cell. In this case, the source cell determines, only according to the key retention policy of the source cell and the key retention policy of the terminal device, to retain the first key, and there may be a case in which the target cell determines, according to the key retention policy of the target cell, to update the key. Therefore, the source cell may add the second key to the handover request message, and send the handover request message to the target cell. If the target cell determines to retain the first key, the target cell may directly communicate with the terminal device based on the received first key. If the target cell determines not to retain the first key, the target cell may directly communicate with the terminal device based on the received second key.

    [0067] It should be understood that the source cell may send the next hop chaining counter (next hop chain counter, NCC) of the second key to the target cell, so that after the target cell makes final decision, the terminal device can obtain the NCC of the second key, and generate the second key based on the NCC, to ensure that the terminal device and the target cell use the same key to communicate with each other.

    [0068] Optionally, the source cell may alternatively send an NCC of the first key to the target cell. This is not limited in this embodiment of this application.

    [0069] In this way, the target cell may directly use the key sent by the source cell, thereby avoiding the following case resulting from that a key derivation algorithm of the target cell is different from a key derivation algorithm of the terminal device: After the terminal device accesses the target cell, a key used by the target cell is inconsistent with a key used by the terminal device.

    [0070] In an optional embodiment, the handover request message further includes use duration information of the first key.

    [0071] Specifically, when the source cell determines to retain the first key, the handover request message may further carry the use duration information of the first key. The target cell may determine, based on the use duration information of the first key and the key retention policy of the target cell, whether to retain the first key. For example, the use duration of the first key cannot exceed the first threshold, and the first threshold may be a specific preset value. If the use duration of the first key exceeds the first threshold, the target cell determines to update the first key.

    [0072] Therefore, when the source cell determines to retain the first key, the source cell sends the use duration information of the first key to the target cell, so that a problem of insecurity resulting from that the first key is not changed for a long time can be avoided.

    [0073] It should be understood that, the use duration information of the first key may be a quantity of seconds for which the first key is used, or a quantity of packet data convergence protocol (packet data convergence protocol, PDCP) packets of which encryption and decryption are implemented by using the first key. This is not limited in this embodiment of this application.

    [0074] In an optional embodiment, when the source cell determines that the terminal device and the target cell do not use the first key to communicate with each other, the handover request message further includes a second key and a next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell.

    [0075] Specifically, when the source cell determines not to retain the first key, the source cell may directly add the second key to the handover request message, and send the handover request message to the target cell; and after receiving the second key, the target cell may directly use the second key to communicate with the terminal device.

    [0076] It should be understood that, the second key may be generated by the source cell according to a key derivation algorithm that is agreed on between the source cell and the terminal device, or may be preconfigured. After generating the second key, the source cell may send the second key to both the target cell and the terminal device; or after generating the second key, the source cell may send the second key only to the target cell, and the terminal device itself generates the second key based on the NCC of the second key. This is not limited in this embodiment of this application.

    [0077] In an optional embodiment, that a source cell obtains a key retention policy of a terminal device includes: The source cell receives the key retention policy of the terminal device sent by a core network device, or the source cell receives the key retention policy of the terminal device sent by the terminal device.

    [0078] Specifically, the source cell may obtain the key retention policy of the terminal device in a plurality of manners. To be specific, the source cell may receive the key retention policy of the terminal device sent by the core network device, or the source cell may directly receive the key retention policy of the terminal device sent by the terminal device. This is not limited in this embodiment of this application.

    [0079] In an optional embodiment, the method further includes: The source cell receives a handover response message sent by the target cell, where the handover response message includes second indication information, and the second indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other; and the source cell sends a radio resource control RRC connection reconfiguration message to the terminal device, where the RRC connection reconfiguration message includes the second indication information.

    [0080] When the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the RRC connection reconfiguration message further includes the NCC of the second key.

    [0081] Specifically, after the source cell sends the handover request message to the target cell, the source cell receives the handover response message sent by the target cell. The handover response message carries the second indication information used to indicate whether to retain the first key. The second indication information includes the key retention policy of the terminal device, the key retention policy of the source cell, and the key retention policy of the target cell. Therefore, when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the source cell may directly and transparently transfer, to the terminal device, the second indication information and the NCC that is used for generating the second key, and notify the terminal device of a final decision; and the terminal device generates the second key.

    [0082] Optionally, the source cell may alternatively transfer the NCC of the first key to the terminal device transparently. This is not limited in this embodiment of this application.

    [0083] FIG 3 is a schematic flowchart of another inter-cell handover method 300 according to an embodiment of this application. The method 300 may be applied to the communications system 100 shown in FIG 1. However, this embodiment of this application is not limited thereto.

    [0084] S310. A target cell receives a handover request message sent by a source cell, where the handover request message is used to request to hand over a terminal device from the source cell to the target cell, the handover request message includes first indication information, the first indication information is used to indicate whether the terminal device and the target cell use a first key to communicate with each other, the source cell and the terminal device use the first key to communicate with each other, the first indication information is determined by the source cell according to a key retention policy of the terminal device and a key retention policy of the source cell, the key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key, and the key retention policy of the source cell is used to indicate a condition for the source cell to determine to retain the first key.

    [0085] S320. The target cell determines, according to the first indication information and a key retention policy of the target cell, whether to use the first key to communicate with the terminal device, where the key retention policy of the target cell is used to indicate a condition for the target cell to determine to retain the first key.

    [0086] According to the inter-cell handover method in this embodiment of this application, the source cell obtains the key retention policy of the terminal device in advance, that is, the key retention policy of the terminal device is considered in advance. The target cell can determine, before communicating with the terminal device, whether to retain an original key finally. This resolves the following problem resulting from that decision of the terminal device lags behind decision of the target cell: Information sent by the terminal device and the target cell is protected still by using the original key when the key is updated. Therefore, when it is determined that the key is updated, the target cell can use a new key to communicate with the terminal device, thereby helping improve inter-cell handover security.

    [0087] In an optional embodiment, when the first indication information indicates that the terminal device and the target cell use the first key to communicate with each other, the handover request message further includes the first key, a second key, and an NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell. The method further includes: When the target cell determines not to use the first key to communicate with the terminal device, the target cell determines to use the second key to communicate with the terminal device.

    [0088] Specifically, when the source cell determines to retain the first key, the source cell may add the first key, the second key, and the NCC of the second key to the handover request message, and send the handover request message to the target cell. The second key is a backup key generated by the source cell. In this case, the source cell determines, only according to the key retention policy of the source cell and the key retention policy of the terminal device, to retain the first key, and there may be a case in which the target cell determines, according to the key retention policy of the target cell, to update the key. Therefore, the source cell may add the second key to the handover request message, and send the handover request message to the target cell. If the target cell determines to retain the first key, the target cell may directly communicate with the terminal device based on the received first key. If the target cell determines not to retain the first key, the target cell may directly communicate with the terminal device based on the received second key.

    [0089] In this way, the target cell may directly use the key sent by the source cell, thereby avoiding the following case resulting from that a key derivation algorithm of the target cell is different from a key derivation algorithm of the terminal device: After the terminal device accesses the target cell, a key used by the target cell is inconsistent with a key used by the terminal device.

    [0090] In an optional embodiment, the handover request message further includes use duration information of the first key, that the target cell determines, according to the first indication information and a key retention policy of the target cell, whether to use the first key to communicate with the terminal device includes: The target cell determines, according to the key retention policy of the target cell and the use duration information of the first key, whether to use the first key to communicate with the terminal device.

    [0091] Specifically, when the source cell determines to retain the first key, the handover request message may further carry the use duration information of the first key. The target cell may determine, based on the use duration information of the first key and the key retention policy of the target cell, whether to retain the first key. For example, use duration of the first key cannot exceed a first threshold, and the first threshold may be a specific preset value. If the use duration of the first key exceeds the first threshold, the target cell determines to update the first key.

    [0092] Therefore, when the source cell determines to retain the first key, the source cell sends the use duration information of the first key to the target cell, so that a problem of insecurity resulting from that the first key is not changed for a long time can be avoided.

    [0093] It should be understood that, the use duration information of the first key may be a quantity of seconds for which the first key is used, or a quantity of packet data convergence protocol (packet data convergence protocol, PDCP) packets of which encryption and decryption are implemented by using the first key. This is not limited in this embodiment of this application.

    [0094] In an optional embodiment, after the target cell determines whether to use the first key to communicate with the terminal device, the method further includes: The target cell sends a handover response message to the source cell, where the handover response message includes second indication information, and the second indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other.

    [0095] When the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the handover response message further includes the NCC of the second key.

    [0096] Specifically, the target cell may send a handover response message to the source cell. When the target cell determines whether to update the key, the handover response message carries the second indication information used to indicate whether to retain the first key. The second indication information includes the key retention policy of the terminal device, the key retention policy of the source cell, and the key retention policy of the target cell. In other words, the second indication information is a final decision whether to retain the first key. In addition, when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the handover response message further carries the NCC of the second key, and the NCC of the second key is transparently transferred by the source cell to the terminal device. The terminal device generates the second key, to ensure that the terminal device and the target cell use the same key to transmit data.

    [0097] FIG 4 is a schematic flowchart of another inter-cell handover method 400 according to an embodiment of this application. The method 400 may be applied to the communications system 100 shown in FIG 1. However, this embodiment of this application is not limited thereto.

    [0098] S410. A terminal device receives a radio resource control RRC connection reconfiguration message sent by a source cell, where the RRC connection reconfiguration message includes second indication information, the second indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other, and the first key is a key used for communication between the source cell and the terminal device.

    [0099] S420. When the second indication information is used to indicate that the terminal device and the target cell do not use the first key to communicate with each other, the terminal device determines to use a second key to communicate with the target cell, where the second key is a backup key used for communication between the terminal device and the target cell.

    [0100] Specifically, the terminal device may receive the RRC connection reconfiguration message sent by the source cell, where the message carries a final decision whether to retain the first key, that is, the second indication information. Because the source cell makes decision according to a key retention policy of the terminal device, the terminal device does not need to perform determining according to the key retention policy of the terminal device, may directly determine, according to the second indication information, whether to retain the first key. When the second indication information indicates that the first key is not retained, the terminal device may use the second key to communicate with the target cell.

    [0101] Therefore, the decision of the terminal device is considered in advance, the source cell determines, according to a key retention policy of the source cell and the key retention policy of the terminal device, whether to retain an original key; and when it is determined to update the key, the target cell can use the new key to communicate with the terminal device, thereby helping improve inter-cell handover security.

    [0102] It should be understood that, the second key may be generated by the source cell according to a key derivation algorithm that is agreed on between the source cell and the terminal device, or may be preconfigured. After generating the second key, the source cell may send the second key to both the target cell and the terminal device; or after generating the second key, the source cell may send the second key only to the target cell, and the terminal device itself generates the second key. This is not limited in this embodiment of this application.

    [0103] In an optional embodiment, the method further includes: When the second indication information is used to indicate that the terminal device and the target cell use the first key to communicate with each other, the terminal device determines to use the first key to communicate with the target cell.

    [0104] In an optional embodiment, when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the RRC connection reconfiguration message further includes an NCC of the second key. The method further includes: The terminal device generates the second key based on the NCC of the second key.

    [0105] In an optional embodiment, before the terminal device receives the radio resource control RRC connection configuration message sent by the source cell, the method further includes: The terminal device sends the key retention policy of the terminal device to the source cell, where the key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key.

    [0106] FIG 5 is a schematic flowchart of another inter-cell handover method 500 according to an embodiment of this application. The method 500 may be applied to the communications system 100 shown in FIG 1. However, this embodiment of this application is not limited thereto.

    [0107] S501. A source cell obtains a security policy of a terminal device, and the source cell and the terminal device use a first key to communicate with each other.

    [0108] Optionally, the source cell may obtain the security policy of the terminal device in a plurality of manners, for example, obtain the security policy of the terminal device from a core network device or obtain the security policy of the terminal device from the terminal device. This is not limited in this embodiment of this application.

    [0109] It should be understood that the security policy of the terminal device may be policy information of whether the terminal device retains a key, for example, information that the key needs to be updated after a specific period of time, and whether the key needs to be updated in the case of heterogeneous handover.

    [0110] S502. The source cell determines, according to the security policy of the terminal device and a security policy of the source cell, whether the terminal device and a target cell use the first key to communicate with each other.

    [0111] Specifically, the security policy of the source cell may be preset. The security policy of the source cell may include whether to update a key forcibly, whether the source cell and the target cell are corresponding to one network element, and another policy. However, this is not limited in this embodiment of this application.

    [0112] S503. The source cell generates a second key based on the first key, where the second key is a backup key used for communication between the terminal device and the target cell.

    [0113] It should be understood that, in this embodiment of this application, S503 may be performed before S501 and S502, may be performed after S501 and S502, or may be performed between S501 and S502. This is not limited in this embodiment of this application.

    [0114] S504. The source cell sends a handover request message to the target cell, where the handover request message is used to request to hand over the terminal device from the source cell to the target cell, the handover request message includes first indication information, and the first indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other.

    [0115] When the source cell determines that the terminal device and target cell use the first key to communicate with each other, the handover request message further includes the first key, the second key, and an NCC of the second key. In this case, the handover request message further includes use duration information of the first key, for example, a quantity of seconds for which the first key is used or a quantity of data packets of which encryption and decryption are implemented by using the first key.

    [0116] When the source cell determines that the terminal device and the target cell do not use the first key to communicate with each other, the handover request message further includes the second key and an NCC of the second key.

    [0117] Correspondingly, the target cell receives the handover request message sent by the source cell, to obtain the key carried in the handover request message.

    [0118] S505. The target cell determines, according to the first indication information and a security policy of the target cell, whether to use the first key to communicate with the terminal device.

    [0119] Specifically, if the first indication information indicates that the terminal device and the target cell do not use the first key to communicate with each other, the target cell may directly determine to use the second key carried in the handover request message (the handover request message includes the second key and the NCC of the second key, and does not include the first key and an NCC of the first key), to communicate with the terminal device. If the first indication information indicates that the terminal device and the target cell use the first key to communicate with each other (the handover request message includes the first key, the second key, the NCC of the second key, and the use duration information of the first key), the target cell needs to determine, according to the security policy of the target cell and the use duration information of the first key, whether to use the first key to communicate with the terminal device.

    [0120] It should be understood that, the security policy of the target cell may be preset, and the security policy of the source cell may include whether to update a key forcibly, whether the source cell and the target cell are corresponding to one network element, whether use duration of the first key exceeds a specific threshold, and another policy. However, this is not limited in this embodiment of this application.

    [0121] When the target cell determines not to use the first key to communicate with the terminal device, the target cell may directly use the second key to communicate with the terminal device.

    [0122] It should be understood that, according to the foregoing procedure, when the source cell determines to retain the first key (that is, the original key used for communication between the source cell and the terminal device), the source cell sends all of the first key, the second key (the backup key used for communication between the target cell and the terminal device), and the NCC of the second key to the target cell. The target cell may directly use the first key or the second key according to the indication information sent by the source cell and the security policy of the target cell, thereby avoiding the following problem resulting from that a key derivation algorithm of the target cell is different from a key derivation algorithm of the terminal device: After the terminal device accesses the target cell, a key used by the terminal device is inconsistent with a key used by the target cell.

    [0123] S506. The target cell sends a handover response message to the source cell, where the handover response message includes second indication information, the second indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other, and when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the handover response message further includes an NCC of the second key; and
    correspondingly, the source cell receives the handover response message sent by the target cell.

    [0124] S507. The source cell sends a radio resource control RRC connection reconfiguration message to the terminal device, where the RRC connection reconfiguration message includes the second indication information, and when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the RRC connection reconfiguration message further includes the NCC of the second key; and
    correspondingly, the terminal device receives the radio resource control RRC connection reconfiguration message sent by the source cell.

    [0125] S508. The terminal device determines, based on the RRC connection reconfiguration message, a key used for communication between the terminal device and the target cell.

    [0126] Specifically, when the second indication information is used to indicate that the terminal device and the target cell use the first key to communicate with each other, the terminal device determines to use the first key to communicate with the target cell; or when the second indication information is used to indicate that the terminal device and the target cell do not use the first key to communicate with each other, the terminal device determines to use the second key to communicate with the target cell.

    [0127] Optionally, when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the RRC connection reconfiguration message further includes the NCC of the second key; and the method further includes:

    the terminal device generates the second key based on the NCC of the second key; and

    when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the terminal device may directly use the existing first key to communicate with the target cell.



    [0128] S509. The terminal device sends an RRC connection reconfiguration complete message to the target cell, to indicate that the terminal device completes setup of an RRC connection.

    [0129] According to the inter-cell handover method in this embodiment of this application, the decision of the terminal device is considered in advance, the source cell determines, according to a key retention policy of the source cell and a key retention policy of the terminal device, whether to retain the original key; and when it is determined to update the key, the target cell can use the new key to communicate with the terminal device, thereby helping improve inter-cell handover security. In addition, in this application, the source cell sends the first key and the second key to the target cell, and the target cell may directly use the key sent by the source cell, thereby avoiding the following case resulting from that a key derivation algorithm of the target cell is different from a key derivation algorithm of the terminal device: After the terminal device accesses the target cell, a key used by the target cell is inconsistent with a key used by the terminal device.

    [0130] It should be understood that the sequence numbers of the foregoing processes do not indicate an execution sequence. An execution sequence of the processes should be determined based on functions and internal logic of the processes, but should not constitute any limitation on an implementation process of this embodiment of this application.

    [0131] The foregoing details the inter-cell handover methods according to the embodiments of this application with reference to FIG 1 to FIG 5. The following details inter-cell handover apparatuses according to the embodiments of this application with reference to FIG 6 to FIG. 11.

    [0132] FIG 6 shows an inter-cell handover apparatus 600 according to an embodiment of this application. The apparatus 600 includes:

    an obtaining unit 610, configured to obtain a key retention policy of a terminal device, where the apparatus and the terminal device use a first key to communicate with each other, and the key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key;

    a determining unit 620, configured to determine, according to the key retention policy of the terminal device and a key retention policy of the apparatus, whether the terminal device and a target cell use the first key to communicate with each other, where the key retention policy of the apparatus is used to indicate a condition for the apparatus to determine to retain the first key; and

    a sending unit 630, configured to send a handover request message to the target cell, where the handover request message is used to request to hand over the terminal device from the apparatus to the target cell, the handover request message includes first indication information, and the first indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other.



    [0133] According to the inter-cell handover apparatus in this embodiment of this application, the source cell obtains the key retention policy of the terminal device in advance, that is, the key retention policy of the terminal device is considered in advance. The target cell can determine, before communicating with the terminal device, whether to retain an original key finally. This resolves the following problem resulting from that decision of the terminal device lags behind decision of the target cell: Information sent by the terminal device and the target cell is protected still by using the original key when the key is updated. Therefore, when it is determined that the key is updated, the target cell can use a new key to communicate with the terminal device, thereby helping improve inter-cell handover security.

    [0134] Optionally, when the apparatus determines that the terminal device and the target cell use the first key to communicate with each other, the handover request message further includes the first key, a second key, and a next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell.

    [0135] Optionally, the handover request message further includes use duration information of the first key.

    [0136] Optionally, when the apparatus determines that the terminal device and the target cell do not use the first key to communicate with each other, the handover request message further includes a second key and a next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell.

    [0137] Optionally, the obtaining unit 610 is specifically configured to: receive the key retention policy of the terminal device sent by a core network device; or receive the key retention policy of the terminal device sent by the terminal device.

    [0138] Optionally, the obtaining unit 610 is specifically configured to: receive a handover response message sent by the target cell, where the handover response message includes second indication information, and the second indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other; and
    send a radio resource control RRC connection reconfiguration message to the terminal device, where the RRC connection reconfiguration message includes the second indication information.

    [0139] When the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the RRC connection reconfiguration message further includes the NCC of the second key.

    [0140] It should be understood that the apparatus 600 is presented in a form of a functional unit. The term "unit" herein may refer to an application-specific integrated circuit (application specific integrated circuit, ASIC), an electronic circuit, a processor configured to execute one or more software or firmware programs (for example, a shared processor, a dedicated processor, or a group processor), a memory, a combined logic circuit, and/or another proper component that supports the described functions. In an optional example, a person skilled in the art can understand that the apparatus 600 may be specifically the source cell in the foregoing embodiments, and the apparatus 600 may be configured to perform procedures and/or steps, corresponding to the source cell, in the foregoing method embodiments. To avoid repetition, details are not repeatedly described herein.

    [0141] FIG 7 shows an inter-cell handover apparatus 700 according to an embodiment of this application. The apparatus 700 includes:

    a receiving unit 710, configured to receive a handover request message sent by a source cell, where the handover request message is used to request to hand over a terminal device from the source cell to the apparatus, the handover request message includes first indication information, the first indication information is used to indicate that the terminal device and the apparatus use a first key to communicate with each other, the source cell and the terminal device use the first key to communicate with each other, the first indication information is determined by the source cell according to a key retention policy of the terminal device and a key retention policy of the source cell, the key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key, and the key retention policy of the source cell is used to indicate a condition for the source cell to determine to retain the first key; and

    a determining unit 720, configured to determine, according to the first indication information and a key retention policy of the apparatus, whether to use the first key to communicate with the terminal device, where the key retention policy of the apparatus is used to indicate a condition for the apparatus to determine to retain the first key.



    [0142] According to the inter-cell handover apparatus in this embodiment of this application, the source cell obtains the key retention policy of the terminal device in advance, that is, the key retention policy of the terminal device is considered in advance. The target cell can determine, before communicating with the terminal device, whether to retain an original key finally. This resolves the following problem resulting from that decision of the terminal device lags behind decision of the target cell: Information sent by the terminal device and the target cell is protected still by using the original key when the key is updated. Therefore, when it is determined that the key is updated, the target cell can use a new key to communicate with the terminal device, thereby helping improve inter-cell handover security.

    [0143] Optionally, when the first indication information indicates that the terminal device and the apparatus use the first key to communicate with each other, the handover request message further includes the first key, a second key, and a next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the apparatus. The determining unit 720 is specifically configured to: when the apparatus determines not to use the first key to communicate with the terminal device, determine to use the second key to communicate with the terminal device.

    [0144] Optionally, the handover request message further includes use duration information of the first key. The determining unit 720 is specifically configured to determine, according to the key retention policy of the apparatus and the use duration information of the first key, whether to use the first key to communicate with the terminal device.

    [0145] Optionally, the apparatus 700 further includes a sending unit, configured to: after it is determined whether to use the first key to communicate with the terminal device, send a handover response message to the source cell, where the handover response message includes second indication information, and the second indication information is used to indicate whether the terminal device and the apparatus use the first key to communicate with each other.

    [0146] When the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the handover response message further includes the NCC of the second key.

    [0147] It should be understood that the apparatus 700 is presented in a form of a functional unit. The term "unit" herein may refer to an application-specific integrated circuit (application specific integrated circuit, ASIC), an electronic circuit, a processor configured to execute one or more software or firmware programs (for example, a shared processor, a dedicated processor, or a group processor), a memory, a combined logic circuit, and/or another proper component that supports the described functions. In an optional example, a person skilled in the art can understand that the apparatus 700 may be specifically the target cell in the foregoing embodiments, and the apparatus 700 may be configured to perform procedures and/or steps, corresponding to the target cell, in the foregoing method embodiments. To avoid repetition, details are not repeatedly described herein.

    [0148] FIG 8 shows an inter-cell handover apparatus 800 according to an embodiment of this application. The apparatus 800 includes:

    a receiving unit 810, configured to receive a radio resource control RRC connection reconfiguration message sent by a source cell, where the RRC connection reconfiguration message includes second indication information, the second indication information is used to indicate whether the apparatus and the target cell use the first key to communicate with each other, and the first key is a key used for communication between the source cell and the apparatus; and

    a determining unit 820, configured to: when the second indication information is used to indicate that the apparatus and the target cell do not use the first key to communicate with each other, determine to use a second key to communicate with the target cell, where the second key is a backup key used for communication between the apparatus and the target cell.



    [0149] According to the inter-cell handover apparatus in this embodiment of this application, the source cell obtains a key retention policy of the terminal device in advance, that is, the key retention policy of the terminal device is considered in advance. The target cell can determine, before communicating with the terminal device, whether to retain an original key finally. This resolves the following problem resulting from that decision of the terminal device lags behind decision of the target cell: Information sent by the terminal device and the target cell is protected still by using the original key when the key is updated. Therefore, when it is determined that the key is updated, the target cell can use a new key to communicate with the terminal device, thereby helping improve inter-cell handover security.

    [0150] Optionally, the determining unit 820 is further configured to: when the second indication information is used to indicate that the apparatus and the target cell use the first key to communicate with each other, determine, for the apparatus, to use the first key to communicate with the target cell.

    [0151] Optionally, when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the RRC connection reconfiguration message further includes an NCC of the second key; and the generation unit is configured to generate the second key based on the NCC of the second key.

    [0152] Optionally, the apparatus 800 further includes a sending unit, configured to: before the radio resource control RRC connection configuration message sent by the source cell is received, send a key retention policy of the apparatus to the source cell, where the key retention policy of the apparatus is used to indicate a condition for the apparatus to determine to retain the first key.

    [0153] It should be understood that the apparatus 800 is presented in a form of a functional unit. The term "unit" herein may refer to an application-specific integrated circuit (application specific integrated circuit, ASIC), an electronic circuit, a processor configured to execute one or more software or firmware programs (for example, a shared processor, a dedicated processor, or a group processor), a memory, a combined logic circuit, and/or another proper component that supports the described functions. In an optional example, a person skilled in the art can understand that the apparatus 800 may be specifically the terminal device in the foregoing embodiments, and the apparatus 800 may be configured to perform procedures and/or steps, corresponding to the terminal device, in the foregoing method embodiments. To avoid repetition, details are not repeatedly described herein.

    [0154] FIG 9 shows another inter-cell handover apparatus 900 according to an embodiment of this application. The apparatus 900 includes a processor 910, a transceiver 920, and a memory 930. The processor 910, the transceiver 920, and the memory 930 communicate with each other through an internal connection path. The memory 930 is configured to store an instruction. The processor 910 is configured to execute the instruction stored in the memory 930, to control the transceiver 920 to send a signal and/or receive a signal.

    [0155] The transceiver 920 is configured to obtain a key retention policy of a terminal device, where the apparatus and the terminal device use a first key to communicate with each other, and the key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key.

    [0156] The processor 910 is configured to determine, according to the key retention policy of the terminal device and a key retention policy of the apparatus, whether the terminal device and a target cell use the first key to communicate with each other, where the key retention policy of the apparatus is used to indicate a condition for the apparatus to determine to retain the first key.

    [0157] The transceiver 920 is further configured to send a handover request message to the target cell, where the handover request message is used to request to hand over the terminal device from the apparatus to the target cell, the handover request message includes first indication information, and the first indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other.

    [0158] It should be understood that the apparatus 900 may be specifically the source cell in the foregoing embodiments, and may be configured to perform the steps and/or procedures, corresponding to the source cell, in the foregoing method embodiments. Optionally, the memory 930 may include a read-only memory and a random access memory, and provide the instruction and data to the processor. A part of the memory may further include a non-volatile random access memory. For example, the memory may further store information about a device type. The processor 910 may be configured to execute the instruction stored in the memory. When the processor 910 executes the instruction stored in the memory, the processor 910 is configured to perform the steps and/or the procedures, corresponding to the source cell, in the foregoing method embodiments.

    [0159] FIG 10 shows another inter-cell handover apparatus 1000 according to an embodiment of this application. The apparatus 1000 includes a processor 1010, a transceiver 1020, and a memory 1030. The processor 1010, the transceiver 1020, and the memory 1030 communicate with each other through an internal connection path. The memory 1030 is configured to store an instruction. The processor 1010 is configured to execute the instruction stored in the memory 1030, to control the transceiver 1020 to send a signal and/or receive a signal.

    [0160] The transceiver 1020 is configured to receive a handover request message sent by a source cell. The handover request message is used to request to hand over a terminal device from the source cell to the apparatus. The handover request message includes first indication information, and the first indication information is used to indicate that the terminal device and the apparatus use the first key to communicate with each other. The source cell and the terminal device use the first key to communicate with each other. The first indication information is determined by the source cell according to a key retention policy of the terminal device and a key retention policy of the source cell. The key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key, and the key retention policy of the source cell is used to indicate a condition for the source cell to determine to retain the first key.

    [0161] The processor 1010 is configured to determine, according to the first indication information and a key retention policy of the apparatus, whether to use the first key to communicate with the terminal device. The key retention policy of the apparatus is used to indicate a condition for the apparatus to determine to retain the first key.

    [0162] It should be understood that the apparatus 1000 may be specifically the target cell in the foregoing embodiments, and may be configured to perform the steps and/or procedures, corresponding to the target cell, in the foregoing method embodiments. Optionally, the memory 1030 may include a read-only memory and a random access memory, and provide the instruction and data to the processor. A part of the memory may further include a non-volatile random access memory. For example, the memory may further store information about a device type. The processor 1010 may be configured to execute the instruction stored in the memory. When the processor 1010 executes the instruction stored in the memory, the processor 1010 is configured to perform the steps and/or the procedures, corresponding to the target cell, in the foregoing method embodiments.

    [0163] FIG 11 shows another inter-cell handover apparatus 1100 according to an embodiment of this application. The apparatus 1100 includes a processor 1110, a transceiver 1120, and a memory 1130. The processor 1110, the transceiver 1120, and the memory 1130 communicate with each other through an internal connection path. The memory 1130 is configured to store an instruction. The processor 1110 is configured to execute the instruction stored in the memory 1130, to control the transceiver 1120 to send a signal and/or receive a signal.

    [0164] The transceiver 1120 is configured to receive a radio resource control RRC connection reconfiguration message sent by a source cell. The RRC connection reconfiguration message includes second indication information, the second indication information is used to indicate whether the apparatus and the target cell use the first key to communicate with each other, and the first key is a key used for communication between the source cell and the apparatus.

    [0165] The processor 1110 is configured to: when the second indication information is used to indicate that the apparatus and the target cell do not use the first key to communicate with each other, determine to use a second key to communicate with the target cell. The second key is a backup key used for communication between the apparatus and the target cell.

    [0166] It should be understood that the apparatus 1100 may be specifically the terminal device in the foregoing embodiments, and may be configured to perform the steps and/or procedures, corresponding to the terminal device, in the foregoing method embodiments. Optionally, the memory 1130 may include a read-only memory and a random access memory, and provide the instruction and data to the processor. A part of the memory may further include a non-volatile random access memory. For example, the memory may further store information about a device type. The processor 1110 may be configured to execute the instruction stored in the memory. When the processor 1110 executes the instruction stored in the memory, the processor 1110 is configured to perform the steps and/or the procedures, corresponding to the terminal device, in the foregoing method embodiments.

    [0167] It should be understood that in this embodiment of this application, the processor in the foregoing apparatus may be a central processing unit (central processing unit, CPU), or the processor may be another general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or another programmable logic device, a discrete gate or a transistor logic device, a discrete hardware component, or the like. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor or the like.

    [0168] In an implementation process, steps in the foregoing methods can be implemented by using a hardware integrated logical circuit in the processor, or by using instructions in a form of software. The steps of the method disclosed with reference to the embodiments of this application may be directly performed by a hardware processor, or may be performed by using a combination of hardware in the processor and a software unit. The software unit may be located in a mature storage medium in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, or a register. The storage medium is located in the memory, and the processor reads an instruction from the memory and completes the steps in the foregoing methods in combination with hardware of the processor. To avoid repetition, details are not repeatedly described herein.

    [0169] It should be noted that the term "and/or" in this specification describes only an association relationship for describing associated objects and represents that three relationships may exist. For example, A and/or B may represent the following three cases: Only A exists, both A and B exist, and only B exists. In addition, the character "/" in this specification generally indicates an "or" relationship between the associated objects.

    [0170] A person of ordinary skill in the art may be aware that, in combination with the examples described in the embodiments disclosed in this specification, method steps and units may be implemented by electronic hardware, computer software, or a combination thereof. To clearly describe the interchangeability between the hardware and the software, the foregoing has generally described steps and compositions of each embodiment according to functions. Whether the functions are performed by hardware or software depends on particular applications and design constraints of the technical solutions. A person of ordinary skill in the art may use different methods to implement the described functions for each particular application, but it should not be considered that the implementation goes beyond the scope of this application.

    [0171] It may be clearly understood by a person skilled in the art that, for ease of convenience and brevity, for a detailed working process of the foregoing system, apparatus, and unit, reference may be made to a corresponding process in the foregoing method embodiments, and details are not repeatedly described herein.

    [0172] In the several embodiments provided in this application, it should be understood that the disclosed system, apparatus, and method may be implemented in other manners. For example, the described apparatus embodiments are merely examples. For example, the unit division is merely logical function division and may be other division in actual implementation. For example, a plurality of units or components may be combined or integrated into another system, or some features may be ignored or not performed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented through some interfaces, indirect couplings or communication connections between the apparatuses or units, or electrical connections, mechanical connections, or connections in other forms.

    [0173] The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual requirements to achieve the objectives of the solutions of the embodiments in this application.

    [0174] In addition, functional units in the embodiments of this application may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in a form of hardware, or may be implemented in a form of a software functional unit.

    [0175] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, the integrated unit may be stored in a computer-readable storage medium. Based on such an understanding, the technical solutions of this application essentially, or the part contributing to the prior art, or all or some of the technical solutions may be implemented in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for instructing a computer device (which may be a personal computer, a server, a network device, or the like) to perform all or some of the steps of the methods described in the embodiments of this application. The foregoing storage medium includes any medium that can store program code, such as a USB flash drive, a removable hard disk, a read-only memory (read-only memory, ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disc.

    [0176] The foregoing descriptions are merely specific implementations of this application, but are not intended to limit the protection scope of this application. Any equivalent modification or replacement readily figured out by a person skilled in the art within the technical scope disclosed in this application shall fall within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.


    Claims

    1. An inter-cell handover method, comprising:

    obtaining, by a source cell, a key retention policy of a terminal device, wherein the source cell and the terminal device use a first key to communicate with each other, and the key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key;

    determining, by the source cell according to the key retention policy of the terminal device and a key retention policy of the source cell, whether the terminal device and a target cell use the first key to communicate with each other, wherein the key retention policy of the source cell is used to indicate a condition for the source cell to determine to retain the first key; and

    sending, by the source cell, a handover request message to the target cell, wherein the handover request message is used to request to hand over the terminal device from the source cell to the target cell, the handover request message comprises first indication information, and the first indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other.


     
    2. The method according to claim 1, wherein when the source cell determines that the terminal device and the target cell use the first key to communicate with each other, the handover request message further comprises the first key, a second key, and a next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell.
     
    3. The method according to claim 2, wherein the handover request message further comprises use duration information of the first key.
     
    4. The method according to claim 1, wherein when the source cell determines that the terminal device and the target cell do not use the first key to communicate with each other, the handover request message further comprises a second key and a next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell.
     
    5. The method according to any one of claims 1 to 4, wherein the obtaining, by a source cell, a key retention policy of a terminal device comprises:

    receiving, by the source cell, the key retention policy of the terminal device sent by a core network device; or

    receiving, by the source cell, the key retention policy of the terminal device sent by the terminal device.


     
    6. The method according to any one of claims 1 to 5, wherein the method further comprises:

    receiving, by the source cell, a handover response message sent by the target cell, wherein the handover response message comprises second indication information, and the second indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other; and

    sending, by the source cell, a radio resource control RRC connection reconfiguration message to the terminal device, wherein the RRC connection reconfiguration message comprises the second indication information, wherein

    when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the RRC connection reconfiguration message further comprises the next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell.


     
    7. An inter-cell handover method, comprising:

    receiving, by a target cell, a handover request message sent by a source cell, wherein the handover request message is used to request to hand over a terminal device from the source cell to the target cell, the handover request message comprises first indication information, the first indication information is used to indicate whether the terminal device and the target cell use a first key to communicate with each other, the source cell and the terminal device use the first key to communicate with each other, the first indication information is determined by the source cell according to a key retention policy of the terminal device and a key retention policy of the source cell, the key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key, and the key retention policy of the source cell is used to indicate a condition for the source cell to determine to retain the first key; and

    determining, by the target cell according to the first indication information and a key retention policy of the target cell, whether to use the first key to communicate with the terminal device, wherein the key retention policy of the target cell is used to indicate a condition for the target cell to determine to retain the first key.


     
    8. The method according to claim 7, wherein when the first indication information indicates that the terminal device and the target cell use the first key to communicate with each other, the handover request message further comprises the first key, a second key, and a next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell; and
    the method further comprises:
    when the target cell determines not to use the first key to communicate with the terminal device, determining, by the target cell, to use the second key to communicate with the terminal device.
     
    9. The method according to claim 8, wherein the handover request message further comprises use duration information of the first key; and
    the determining, by the target cell according to the first indication information and a key retention policy of the target cell, whether to use the first key to communicate with the terminal device comprises:
    determining, by the target cell according to the key retention policy of the target cell and the use duration information of the first key, whether to use the first key to communicate with the terminal device.
     
    10. The method according to claim 8 or 9, wherein after the determining, by the target cell, whether to use the first key to communicate with the terminal device, the method further comprises:

    sending, by the target cell, a handover response message to the source cell, wherein the handover response message comprises second indication information, and the second indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other, wherein

    when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the handover response message further comprises the NCC.


     
    11. An inter-cell handover method, comprising:

    receiving, by a terminal device, a radio resource control RRC connection reconfiguration message sent by a source cell, wherein the RRC connection reconfiguration message comprises second indication information, the second indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other, and the first key is a key used for communication between the source cell and the terminal device; and

    when the second indication information is used to indicate that the terminal device and the target cell do not use the first key to communicate with each other, determining, by the terminal device, to use a second key to communicate with the target cell, wherein the second key is a backup key used for communication between the terminal device and the target cell.


     
    12. The method according to claim 11, wherein the method further comprises:
    when the second indication information is used to indicate that the terminal device and the target cell use the first key to communicate with each other, determining, by the terminal device, to use the first key to communicate with the target cell.
     
    13. The method according to claim 11 or 12, wherein when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the RRC connection reconfiguration message further comprises a next hop chaining counter NCC of the second key; and
    the method further comprises:
    generating, by the terminal device, the second key based on the NCC of the second key.
     
    14. The method according to any one of claims 11 to 13, wherein before the receiving, by the terminal device, a radio resource control RRC connection configuration message sent by a source cell, the method further comprises:
    sending, by the terminal device, a key retention policy of the terminal device to the source cell, wherein the key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key.
     
    15. An inter-cell handover apparatus, comprising:

    an obtaining unit, configured to obtain a key retention policy of a terminal device, wherein the apparatus and the terminal device use a first key to communicate with each other, and the key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key;

    a determining unit, configured to determine, according to the key retention policy of the terminal device and a key retention policy of the apparatus, whether the terminal device and a target cell use the first key to communicate with each other, wherein the key retention policy of the apparatus is used to indicate a condition for the apparatus to determine to retain the first key; and

    a sending unit, configured to send a handover request message to the target cell, wherein the handover request message is used to request to hand over the terminal device from the apparatus to the target cell, the handover request message comprises first indication information, and the first indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other.


     
    16. The apparatus according to claim 15, wherein when the apparatus determines that the terminal device and the target cell use the first key to communicate with each other, the handover request message further comprises the first key, a second key, and a next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell.
     
    17. The apparatus according to claim 16, wherein the handover request message further comprises use duration information of the first key.
     
    18. The apparatus according to claim 15, wherein when the apparatus determines that the terminal device and the target cell do not use the first key to communicate with each other, the handover request message further comprises a second key and a next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell.
     
    19. The apparatus according to any one of claims 15 to 18, wherein the obtaining unit is specifically configured to:

    receive the key retention policy of the terminal device sent by a core network device; or

    receive the key retention policy of the terminal device sent by the terminal device.


     
    20. The apparatus according to any one of claims 15 to 19, wherein the obtaining unit is specifically configured to:

    receive a handover response message sent by the target cell, wherein the handover response message comprises second indication information, and the second indication information is used to indicate whether the terminal device and the target cell use the first key to communicate with each other; and

    send a radio resource control RRC connection reconfiguration message to the terminal device, wherein the RRC connection reconfiguration message comprises the second indication information, wherein

    when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the RRC connection reconfiguration message further comprises the next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the target cell.


     
    21. An inter-cell handover apparatus, comprising:

    a receiving unit, configured to receive a handover request message sent by a source cell, wherein the handover request message is used to request to hand over a terminal device from the source cell to the apparatus, the handover request message comprises first indication information, the first indication information is used to indicate that the terminal device and the apparatus use a first key to communicate with each other, the source cell and the terminal device use the first key to communicate with each other, the first indication information is determined by the source cell according to a key retention policy of the terminal device and a key retention policy of the source cell, the key retention policy of the terminal device is used to indicate a condition for the terminal device to determine to retain the first key, and the key retention policy of the source cell is used to indicate a condition for the source cell to determine to retain the first key; and

    a determining unit, configured to determine, according to the first indication information and a key retention policy of the apparatus, whether to use the first key to communicate with the terminal device, wherein the key retention policy of the apparatus is used to indicate a condition for the apparatus to determine to retain the first key.


     
    22. The apparatus according to claim 21, wherein when the first indication information indicates that the terminal device and the apparatus use the first key to communicate with each other, the handover request message further comprises the first key, a second key, and a next hop chaining counter NCC of the second key, and the second key is a backup key used for communication between the terminal device and the apparatus; and
    the determining unit is specifically configured to:
    when the apparatus determines not to use the first key to communicate with the terminal device, determine to use the second key to communicate with the terminal device.
     
    23. The apparatus according to claim 22, wherein the handover request message further comprises use duration information of the first key; and
    the determining unit is specifically configured to:
    determine, according to the key retention policy of the apparatus and the use duration information of the first key, whether to use the first key to communicate with the terminal device.
     
    24. The apparatus according to claim 22 or 23, wherein the apparatus further comprises:

    a sending unit, configured to: after it is determined whether to use the first key to communicate with the terminal device, send a handover response message to the source cell, wherein the handover response message comprises second indication information, and the second indication information is used to indicate whether the terminal device and the apparatus use the first key to communicate with each other, wherein

    when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the handover response message further comprises the NCC.


     
    25. An inter-cell handover apparatus, comprising:

    a receiving unit, configured to receive a radio resource control RRC connection reconfiguration message sent by a source cell, wherein the RRC connection reconfiguration message comprises second indication information, the second indication information is used to indicate whether the apparatus and the target cell use the first key to communicate with each other, and the first key is a key used for communication between the source cell and the apparatus; and

    a determining unit, configured to: when the second indication information is used to indicate that the apparatus and the target cell do not use the first key to communicate with each other, determine to use a second key to communicate with the target cell, wherein the second key is a backup key used for communication between the apparatus and the target cell.


     
    26. The apparatus according to claim 25, wherein the determining unit is further configured to:
    when the second indication information is used to indicate that the apparatus and the target cell use the first key to communicate with each other, determine, for the apparatus, to use the first key to communicate with the target cell.
     
    27. The apparatus according to claim 25 or 26, wherein when the second indication information indicates that the terminal device and the target cell use the second key to communicate with each other, the RRC connection reconfiguration message further comprises a next hop chaining counter NCC of the second key; and the apparatus further comprises:
    a generation unit, configured to generate the second key based on the NCC of the second key.
     
    28. The apparatus according to any one of claims 25 to 27, wherein the apparatus further comprises:

    a sending unit, configured to: before the radio resource control RRC connection configuration message sent by the source cell is received, send a key retention policy of the apparatus to the source cell, wherein the key retention policy of the apparatus is used to indicate a condition for the apparatus to determine to retain the first key.
     




    Drawing