Security Activation

Once Authentication and Key Agreement (AKA) has been completed, both the UE and the Core Network have a shared key. From this point on, all communication between the UE and the Core Network will be done over NAS and all communication between the UE and the gNodeB will done over RRC. If you take a look at the image, you see the flow between the UE, gNodeB and Core Network. Here you see the Access Stratum and Non-Access Stratum as well, showing the division of NAS and RRC.
5G Overview

At the NAS communication, NAS Security Mode Command ensures confidentiality and there is integrity protection, at the 3GPP Specifications at 6.7.2, information can be found on which algorithms should be used. Then at the AS communication, RRC Security Mode Command offers the same security features as NAS, namely confidentiality and integrity, which can be found in 3GPP Specifications at 6.7.4.