The UE may obtain the public key of the UDM by using a broadcast message or in another manner.
In Embodiment 2 shown in FIG. 6A and FIG. 6B, the UE performs digital signing on the location privacy setting data. When receiving the location privacy setting data obtained through digital signing, the UDM verifies the location privacy setting data, and determines whether the location privacy setting data is maliciously modified by the visited network or the GMLC. When authentication succeeds, the UDM performs digital signing on the location privacy setting data, and delivers the location privacy setting data obtained through digital signing to the UE. The UE verifies the location privacy setting data. Two authentication processes can effectively prevent the location privacy setting data from being tampered with, thereby ensuring end-to-end integrity protection of the location privacy setting data between the UE and the UDM.
An example in which this embodiment of this application is applied to the schematic diagram of the network architecture shown in FIG. 4 is used. FIG. 7A and FIG. 7B are a schematic flowchart of a data transmission method according to Embodiment 3 of this application. In this embodiment, an AMF is used to check whether action indication information delivered by a visited network or a GMLC to the AMF is tampered with, to effectively prevent the visited network or the GMLC from delivering incorrect action indication information, thereby effectively protecting location information of UE. The embodiment shown in FIG. 7A and FIG. 7B may include but are not limited to the following steps.