Section: 5.3.4.3 Reception of the SecurityModeCommand by the UE
Content: The UE shall: 1> derive the KgNB key, as specified in TS 33.501[ Security architecture and procedures for 5G System ]  [11]; 1> derive the KRRCint key associated with the integrityProtAlgorithm indicated in the SecurityModeCommand message, as specified in TS 33.501[ Security architecture and procedures for 5G System ]  [11]; 1> request lower layers to verify the integrity protection of the SecurityModeCommand message, using the algorithm indicated by the integrityProtAlgorithm as included in the SecurityModeCommand message and the KRRCint key; 1> if the SecurityModeCommand message passes the integrity protection check: 2> derive the KRRCenc key and the KUPenc key associated with the cipheringAlgorithm indicated in the SecurityModeCommand message, as specified in TS 33.501[ Security architecture and procedures for 5G System ]  [11]; 2> derive the KUPint key associated with the integrityProtAlgorithm indicated in the SecurityModeCommand message, as specified in TS 33.501[ Security architecture and procedures for 5G System ]  [11]; 2> configure lower layers to apply SRB integrity protection using the indicated algorithm and the KRRCint key immediately, i.e. integrity protection shall be applied to all subsequent messages received and sent by the UE, including the SecurityModeComplete message; 2> configure lower layers to apply SRB ciphering using the indicated algorithm, the KRRCenc keyafter completing the procedure, i.e. ciphering shall be applied to all subsequent messages received and sent by the UE, except for the SecurityModeComplete message which is sent unciphered; 2> consider AS security to be activated; 2> submit the SecurityModeComplete message to lower layers for transmission, upon which the procedure ends; 1> else: 2> continue using the configuration used prior to the reception of the SecurityModeCommand message, i.e. neither apply integrity protection nor ciphering. 2> submit the SecurityModeFailure message to lower layers for transmission, upon which the procedure ends.