A wireless 5th generation, 5G, communication method, used in a scenario in which a handover of an apparatus fails, wherein the apparatus is a terminal or a chip in the terminal, wherein the method comprises: sending (701, 901), by the apparatus, a reestablishment request message to a base station, wherein the reestablishment request message is used to reestablish a radio resource control, RRC, connection; receiving (703, 903), by the apparatus, a reestablishment message from the base station, wherein the reestablishment message comprises a next hop chaining counter, NCC, and key derivation information; deriving (705, 904), by the apparatus, a first access stratum key of the apparatus based on the key derivation information and a root key of the apparatus; deriving (706, 905), by the apparatus, a second access stratum key of the apparatus based on the NCC and the first access stratum key of the apparatus; and sending (707, 906), by the apparatus, a reestablishment complete message to the base station, wherein the reestablishment complete message is protected by using a key derived based on the second access stratum key of the apparatus, wherein the base station is a target station to which the apparatus is to be handed over in the handover procedure, wherein the key derivation information comprises a first indication and a non-access stratum container, NASC, the NASC comprises a second indication and a downlink NAS COUNT indication, the first indication is used to indicate to update an access stratum key, and the second indication is used to indicate to update the root key; and the deriving, by the apparatus, a first access stratum key of the apparatus based on the key derivation information and a root key of the apparatus comprising: deriving, by the apparatus, a second root key of the apparatus based on the second indication, the downlink NAS COUNT indication, and a first root key of the apparatus; and deriving, by the apparatus, the first access stratum key of the apparatus based on the first indication and the second root key of the apparatus. sending (701, 901), by the apparatus, a reestablishment request message to a base station, wherein the reestablishment request message is used to reestablish a radio resource control, RRC, connection; receiving (703, 903), by the apparatus, a reestablishment message from the base station, wherein the reestablishment message comprises a next hop chaining counter, NCC, and key derivation information; deriving (705, 904), by the apparatus, a first access stratum key of the apparatus based on the key derivation information and a root key of the apparatus; deriving (706, 905), by the apparatus, a second access stratum key of the apparatus based on the NCC and the first access stratum key of the apparatus; and sending (707, 906), by the apparatus, a reestablishment complete message to the base station, wherein the reestablishment complete message is protected by using a key derived based on the second access stratum key of the apparatus, wherein the base station is a target station to which the apparatus is to be handed over in the handover procedure, wherein the key derivation information comprises a first indication and a non-access stratum container, NASC, the NASC comprises a second indication and a downlink NAS COUNT indication, the first indication is used to indicate to update an access stratum key, and the second indication is used to indicate to update the root key; and the deriving, by the apparatus, a first access stratum key of the apparatus based on the key derivation information and a root key of the apparatus comprising: deriving, by the apparatus, a second root key of the apparatus based on the second indication, the downlink NAS COUNT indication, and a first root key of the apparatus; and deriving, by the apparatus, the first access stratum key of the apparatus based on the first indication and the second root key of the apparatus. deriving, by the apparatus, a second root key of the apparatus based on the second indication, the downlink NAS COUNT indication, and a first root key of the apparatus; and deriving, by the apparatus, the first access stratum key of the apparatus based on the first indication and the second root key of the apparatus.