It should be noted that calculating the message authentication code based on the freshness parameter is a possible implementation, and does not constitute a limitation on this embodiment of this application. For example, the message authentication code may further be calculated based on a random value. Further, the UE calculates the first message authentication code of the first location privacy setting data based on a first random value, and then the UE sends the first message authentication code, the first location privacy setting data, and the first random value to the UDM. The UDM sends the first random value and the first location privacy setting data to the AUSF. The AUSF calculates the second message authentication code based on the first random value, generates a second random value, and calculates the third message authentication code based on the second random value. Then, the AUSF sends the second message authentication code, the third message authentication code, and the second random value to the UDM. When determining that the second message authentication code is the same as the third message authentication code, the UDM delivers the third message authentication code and the second random value to the UE, and the UE calculates the fourth message authentication code based on the second random value.
Further, in a subsequent embodiment, performing digital signing based on the freshness parameter is also a possible implementation, and does not constitute a limitation on this embodiment of this application. For example, the UE performs digital signing on the first location privacy setting data based on a random value and a private key of the UE, the UDM performs digital signing on the first location privacy setting data based on another random value and the private key of the UDM.