ng on the application-level input from the AF and may be stand-alone or co-located with the PCF. The security policy may include 5G Network Architecture Network side UE side CK, IK 5G AKA EAP-AKA' CK', IK' KAUSF KSEAP KNASint KNASenc KN3IWF KgNB, NH KRRCint KRRCenc KUPint KUPenc N3IWF Mobile equipment (ME) Figure 1.91 Key hierarchy in 5GS [9]. information about AUSF selection, confidentiality protection algorithm, integrity protection algorithm, key length and key life cycle. Fig. 1.91 shows the key hierarchy in 5GS [54]. The new security anchor key KSEAF is used to further derive the access network key KAN and the NAS keys KNAS. There is only one NAS security termination entity, which is the AMF. The user-plane data on the radio bearer can be secured on a per session basis with the key KUP. A session can belong to the same or different network slices. All key sets for NAS, RRC, and user-plane consist of an integrity key and a confidentiality key for encryp- tion. Recall that the termination point of the user-plane security is at eNB in LTE networks. However, the gateway location may vary in order to provide different type of services, and the gNB may be located at the edge, that is, an exposed environment. Thus, the termination point of user-plane security should be reconsidered with the principle that security termina- tion is in the entity where the traffic terminates. The user-plane security terminates at PDCP sublayer of gNB. This is aligned with LTE security framework that radio interface security 190 Chapter 1 is provided by the PDCP layer for control and user planes. This mechanism allows provi- sioning the security termination point in a CU of the gNB that typically resides in a secure location. The key hierarchy shown in Fig. 1.90 includes the following keys: KSEAF, KAMF, KNASint, KNASenc, KN3IWF, KgNB, KRRCint, KRRCenc, KUPint and KUPenc, which can be divided into the following groups [9]: Keys for NAS signaling include KNASint, which is a key that is used for the protection of NAS signaling with a par