Getting extra numbers when reading SIM IMSI


#1

I’ve got an EM7565 modem and I’m having trouble understanding the output from reading the transparent on the SIM. I’m using linux with libqmi to read the transparent from the modem.

Running the commands using a verizon SIM:
qmicli -p -d /dev/cdc-wdm0 --uim-read-transparent 3F00,7FFF,6F07

gives:
[/dev/cdc-wdm0] Successfully read information from the UIM:
Card result:
SW1: ‘0x90’
SW2: ‘0x00’
Read result:
08:39:11:84:00:58:25:10:77

The correct result according to running the at command cimi is:
AT+CIMI: 311480085520177

Now libqmi is getting all of the correct values-just need to swap every pair of values to get 809311480085520177. Which is close except for the 809 on the front of it.

Edit: I was also able to get the output from an ATT sim: 809310410619745246
Same deal.

So my question is, is that something that will show up for every SIM? Can I safely just trim off the first 3 numbers when reading the IMSI from the transparent for every SIM (verizon, sprint, t-mobile, att, etc.)?


#2

Hi,

when reading out EF_IMSI directly from the SIM you always get the raw format with the length byte (‘08’) as the first byte and the parity info (‘9’) in the lower nibble of the second byte. Trimming off the first three digits is only safe if you know that all IMSIs used have an odd number of digits.

For the general case you would have to take padding with ‘F’ nibbles as described in section 4.2.2 of TS 31.102 (Characterictics of the USIM application) into account.

Regards,
Reinhard


#3

Hi Reinhard, thanks for the reply! I am a bit confused on the general case though…
I’m kind of a newbie when it comes to bits and bytes. You say that I can only trim off the first three if it’s an odd number of digits, does that mean if it’s even the ‘9’ will change to say 10 thus making the 3 digit trim not trim the ‘0’ in ‘10’?

Also with the ‘F’ padding… Where would the F’s go for filling the empty spaces in the IMSI? I’m assuming at the end of the IMSI?


#4

Please search for “TS 31.102” with the search engine of your choice which should provide you with a link to the corresponding PDF file from the ETSI web site. Section 4.2.2 contains all the details about length information, ordering of IMSI digits and ‘F’ padding nibbles.

Regards,
Reinhard