You are currently viewing How to extract MCC and MNC from IMSI stored in USIM

How to extract MCC and MNC from IMSI stored in USIM

How to extract MCC and MNC from IMSI stored in USIM

As per 3GPP 24.003 section 2.2 & 2.3, the IMSI (International Mobile Subscriber Identity) is a unique number, assigned to each mobile subscriber, containing at most 15 decimal digits. These digits are composed of 3 parts

  1. MCC (Mobile Country Code) consists of3 digits,
  2. MNC (Mobile Network Code) consists of 2 or 3 digits.
  3. MSIN (Mobile Subscriber Identification Number) consists of the rest of the digits.

The value of MNC (two or three digits) depends on the value of MCC.

 

IMSMCCMNC

 

The IMSI is stored in the UICC and can be accessed through the USIM application. 3GPP 31.102 section 4.2.2 specifies that the EFIMSI contains the details of the IMSI. But there is no direct access to MCC and MNC and hence they need to be extracted from the IMSI. As MCC is of fixed length there is no issue in extracting it, but as MNC is of variable length, the question is how to extract the exact value from IMSI. As MNC value is dependent on the value of MCC, should we maintain a table of MCC and the corresponding length of MNC and consult it while extracting MNC? The answer is no but 3GPP 31.102 section 4.2.18 answers the question; the 4th byte of EFAD contains the length of the MNC which can be used to extract it from IMSI.

Note – If the MNC contains 2 digits a ‘0’ is then added at the beginning to use the 3-digit value while constructing the temporary home domain, temporary private identity, and temporary public user identity (3GPP 23.003 section 13.2, 13.3, and 13.4) for IMS network (when no ISIM is present).

Author: Soumalya Kumar De