Some basics about SIM cards
Mobile Station consist of Mobile Equipment (GSM mobile phone) and
Subscriber Identity Module (SIM card). The separation of Mobile
Equipment and SIM means that it is possible to put the SIM into another
Mobile Equipment and use it with your own identity.
SIM card contains data needed for authentication and identification of
mobile phone user in mobile network. SIM consists of the mobile's data
bank and free usable memory.
Data bank consists of:
- Administrating data:
- The Personal Identification Number - PIN
- The Pin Unblocking Key - PUK
- The SIM-Service Table (which indicates which services are
allocated, and whether, if allocated, the service is activated. If a
service is not allocated or not activated in the SIM, the ME shall not
select this service)
- Authentication and Ciphering:
- The Encoding algorithms (A3, A8), identical to the ones held in the network, and the authentication computation
- Ciphering Key Sequence Number (CKSN) (3 bit) identical to the one held in the network
- authentication key Ki
- encryption key Kc, which originates from Ki key
- Subscriber specific:
- International Mobile Subscriber Identity - IMSI: IMSI is
identifier number of mobile phone user in GSM network. When user
introduces himself into GSM network, GSM network associates his calling
number with IMSI number. IMSI number should be transferred over the
network as rare as possible, instead it there should be used random
generated TMSI number.
TMSI is limited to local area. IMSI number is usually transferred "over
the air" when mobile phone is switched on or when mobile phone changes
local area. IMSI number consist of Mobile Country Code
(MCC) (first 3 characters); Mobile Network Code (MNC - code of mobile
network) (2 characters in european or 3 characters in U.S.); Mobile
Subscriber Identification Number (MSIN) (the rest characters). Mobile
Country Code 901 means International Shared Codes. "901 08" is
identification mobile phone without SIM cards (for emergency calls).
- Temporary Mobile Subscriber Identity - TMSI, given to the mobile by the network during roaming (to hide the IMSI)
- Roaming data:
- Local Area Identity - LAI
- Preferred PLMNs list (PLMN - Public Land Mobile Network, contains Mobile Country Code (MCC) and Mobile Network Code (MNC))
- Forbidden PLMNs list
- List of beacon frequencies (ARFCNs (Absolute Radio Frequency Numbers) of the home PLMN)
- Storage of location information
- Personal data of the user:
- Directory number of a mobile radio subscriber MSISDN
- Storage of SMS, Telephone Numbers, etc.
SIM card also contains the following data:
- ICCID (Integrated Circuit Card ID) or "serial ID of the SIM
card" is an identification number of SIM card. It is generated and
written to SIM card in the process of "personalisation" of SIM card,
usually is also printed on a SIM card. It is 19 characters long (for
Phase 2 SIM cards) or 20 characters long (for Phase 1 SIM cards).
It has the following elements based on a ISO/IEC standard 7812:
identification number of issuer (7 characters max.) and identification
number of card. Identification number of issuer consisted of: Major
Industry Identifier - MII (2 characters, for tellecomunications code is
89); country code
(1 to 3 characters); identification of the issuer (mobile operator, the
rest characters). Identification number of card: account identification
number (up to 12 characters) and checksum computed by Luhn algorithm].
- number for emergency call (depends on operator of the network),
- other data needed to transfer data between operator of
the network and mobile phone user, for example SMSC (Short Message
Service Center) number, Service Provider Name (SPN), Service Dialing
Numbers (SDN), etc.,
- logical controls for controlling access to data on a SIM card.
Reading SIM cards
For reading SIM cards you need SIM card reader.
Basically you need:
- some hardware (you can build your own for a few USD dollars or buy a starter kit);
- 9 V battery,
- pySIMReader script (for Linux, Mac and Windows);
- Python with pySerial and wxPython libraries.
Since SIM Card Reader from Ladyada.net uses serial port for connecting
to computer, you may also need serial to USB converter cable, for
instance USB-serial DB09 Aten. Under Linux you will have emulated serial
port on /dev/ttyUSB0.
Then you unzip Python scripts, connect the reader, insert SIM card and run the script:
python pySimReader.py
Then you select the serial port where SIM Card Reader is connected and
then you can read your SIM card. However, you need to enter your PIN
code, because data on SIM card are locked with it.
With the program you can:
- read basic info from SIM card;
- read phone directory
- read SMS messages and recover deleted SMS messages
- read last dialed number
Please note, that some of this information is not stored on a SIM
card, because new mobile phones save that info in their internal memory.