Section: 4.4.3.4 Ciphering and deciphering
Content: The sender shall use its locally stored NAS COUNT as input to the ciphering algorithm. The receiver shall use the NAS sequence number included in the received message and an estimate for the NAS overflow counter as defined in subclause 4.4.3.1 to form the NAS COUNT input to the deciphering algorithm. The input parameters to the NAS ciphering algorithm are the BEARER ID, DIRECTION bit, NAS COUNT, NAS encryption key and the length of the key stream to be generated by the encryption algorithm. When applying initial NAS message protection to the REGISTRATION REQUEST, DEREGISTRATION REQUEST or SERVICE REQUEST message as described in subclause 4.4.6, the length of the key stream is set to the length of the entire plain NAS message that is included in the NAS message container IE, i.e. the value part of the NAS message container IE, that is to be ciphered. When applying initial NAS message protection to the CONTROL PLANE SERVICE REQUEST message as described in subclause 4.4.6, the length of the key stream is set to the length of: a) the value part of the CIoT small data container IE that is to be ciphered; or b) the value part of the NAS message container IE that is to be ciphered.