e AuC and is based on the Subscriber Identity Module (SIM) card. Measures are taken to ensure that the K can- not be read from the SIM card. K is never transmitted over the network. Ciphering Ciphering is used over the air interface following the authentication proce- dure to provide security for voice and data traffic. Algorithm 5 (A5) is used with K and the current Time Division Multiple Access (TDMA) frame Downloaded from Digital Engineering Library @ McGraw-Hill (www.digitalengineeringlibrary.com) Copyright © 2004 The McGraw-Hill Companies. All rights reserved. Any use is subject to the Terms of Use as given at the website. Mobile Station to SGSN Interface Chapter 8 number as inputs to generate a ciphering code. The mobile station calcu- lates K from the RAND and Ki and stores it on the SIM. The Base Station Subsystem (BSS) is given K by the Visitor Location Register (VLR). In the uplink direction, the mobile ciphers the data and the BSS deciphers it. A similar process takes place on the downlink. The cipher key is different in the uplink and downlink direction. The TDMA frame number changes approximately every 4.6 ms (a TDMA frame period) and is not repeated for 3.5 hours, making it difficult for the cipher code to be cracked. Some coun- tries allow ciphering as an option; others forbid it. Figure 8-6 shows this sequence. In GPRS, the ciphering is no longer performed between the Base Trans- ceiver System (BTS) and the mobile station, but at the LLC level between the SGSN and the mobile station. Just as we saw in GSM, a ciphering key K is produced by the Ag algorithm from the identification key Ki and a non- predictable RAND is generated by the AuC and transmitted by the network to the mobile station. Each time a mobile station is authenticated, the A5 algorithm is used to calculate the expected sequence used for ciphering and deciphering in the mobile station and in the SGSN. The A5 algorithm is stored in the mobile equipment and in the SGSN. Thus, the A5 is manufacturer-dependent. This is shown in Figure 8-