Getting the TMSI from the SIM card - android

Is it possible, in Android or any other mobile OS, to access the encrypted information passed from the SIM card to the cellular network? I mean the mobile signature, or the TMSI number. I need this data after it is encripted by the sim. I mean the IMSI after it is encrypted by the SIM to be sent to the network.
Thanks :)

Impossible. Android so far does not provide any direct API's and/or other interfaces to SIM card, except for some basic information like country code, operator name, etc, which is kindly provided by TelephonyManager.
Additionally, SIM interface normally is connected to modem CPU, not application one, thus eliminating any possible hacks/workarounds.

As I know SIM doesn't encrypt the IMSI information,that's the one reason to use TMSI.

Exactly, SIM doesn't do that. Its all done using Hardware of phone. And TMSI don't have anything to do with phone. It is used in radio interfaces just to secure user information and confidentiality. Phone will be always identified by IMSI not TMSI.
Basically they uses some key values. And those keys do the twist. Algorithm A5 and A8 are used for key purpose.
Pankaj Singh

Related

Question related to hardware, arduino etc

Is there any possibility to get the number from the mobile sim card using any sensor ???
For example, if a person have a mobile phone in her hand and when the person pass from the gate we want to get the number of that sim card whose in her mobile phone!
Not possible!! You cannot get the number directly from the Simcard chip.
The encrypted data and some other data!
https://www.elprocus.com/how-sim-card-works/
You can read the above article to be more clear!
No. Telephone number isn't stored on a sensor, it is obtained from the network, and if you want to make it available to your application you will need to have obtained permission to the telephony service, and you can then access it through a TelephonyManager object.

Android Telephony - dual SIM versus single SIM with multiple IMSI

Mobile handsets can have dual SIMs, where each SIM (usually) has a single IMSI. However it is possible for a SIM card to have dual IMSI as well, and in fact IMSI that can be "configured on it" on-the-fly by operator. The latter mechanism is used for roaming scenarios, such as for business customers, where one (fixed) IMSI will be used by your home-country operator's phone number, and the other (flexible) IMSI that could be configured to visited-country operator's phone number (with whom your operator has a specific roaming arrangement). This way people can call you on either number, and you do not have to swap SIMs. Note that this was possible even before dual-SIM phones became relatively common.
For multi-SIM, I found some answers such as this one where one answer suggests using MultiSIM API (from 3rd party), and another answer suggests using the official supported API available since Android 5.1 (API level >22) or the unsupported TelephonyManager way from this answer (which I presume works for older API levels as well). However, it is not evident if those API's work for single SIM multi IMSI as well.
Unfortunately, I am yet to lay my hands on dual-IMSI SIM card to try this out. While I am trying to procure one, can anyone who has tried confirm or share findings ?
I'm not exactly sure what the question is, however a single SIM will only ever have one active imsi. Yes SIM cards can can multiple imsi's and an operator can update the imsi. However a SIM will only have ONE active IMSI.
A SIM can only have one active IMSI due to the SIM specification which says a IMSI must be stored in file ID:
3F00 (MF) -> 7F20 -> (DF_GSM) -> 6F07 (EF_IMSI).
A device (phone/modem) will request the IMSI from this file and only this file. if they were two "active" IMSI's no device currently would know where to find that IMSI without a firmware change.

How to find out phone number of a sim given its IMEI number?

I have a dual sim Android phone. Using this solution I retrieve IMEI numbers of both sims.
Given the IMEI number, how can I find out the phone number of each sim?
There are methods getDeviceIdGemini(int slotId) and getSimStateGemini(int slotId) it is possible to find out the IMEI number and the state of each sims.
I'm looking for a similar method for reading the phone number of the sim.
You can't. Phone number it's not stored on sim card, it's stored on operator's servers. Look for TelephonyManager.getSubscriberId(), this will give the unique id for each SIM.
Programmatically obtain the phone number of the Android phone
Basic answer- there is no way to get your current phone number. There's things that sometimes work, but not always and not on all carriers.
No,
Android doesn't support dual sim devices.
See: Detect the status of two SIM cards in a dual-SIM Android phone
as Android does not support multiple SIMs, at least from the SDK.
You can contact your device manufacturer and see if they have an SDK add-on or something that allows you to access the second SIM.May be an API which can help youto get your desired result.
Although you can find out the status of the device whether it is Dual sim or not by using this link Android : Check whether the phone is dual SIM
Using reflection, I looked at the methods of TelephonyManager and found this method: int getLine1NumberGemini(int).
I tried to invoke it (getLine1NumberGemini(0) for first sim and getLine1NumberGemini(1) for the second). In both cases I received an empty string.
But the reason for this seems to be the inability of the phone to get the phone number of my sims:
TelephonyManager.getLine1Number() returns empty string as well.
When I open "Sim management" in the settings of the phone, no phone numbers are displayed.

Fetching Android MSISDN value

I have a query. Can someone please guide me how to get my MOBILE MSISDN Number. Is there any sample application for fetching/ displaying the MSISDN number. I need to get the MSISDN number. Any sample project will be of great help.
Thanks in advance.
It has been covered in some topics, namely: Programmatically obtain the phone number of the Android phone .
However, bear in mind that this doesn't always work. With a couple of portuguese SIM cards at least, I wasn't able to retrieve the phone number using these methods.
Quoting from #Johan's answer in that topic:
There is no guaranteed solution to this problem because the phone
number is not physically stored on all SIM-cards, or broadcasted from
the network to the phone. This is especially true in some countries
which requires physical address verification, with number assignment
only happening afterwards. Phone number assignment happens on the
network - and can be changed without changing the SIM card or device
(e.g. this is how porting is supported).
I know it is pain, but most likely the best solution is just to ask
the user to enter his/her phone number once and store it.

Is IMSI number unique for each phone

Is IMSI number unique for each phone ?
I want to know the answer with respect to Android.
Please help.
Wikipdia:
An International Mobile Subscriber Identity or IMSI (play /ˈɪmziː/) is a unique identification associated with all GSM and UMTS network mobile phone users.
Not all android devices are on GSM or UMTS. So I would guess that the ones that don't use those networks aren't going to have any value at all for IMSI. But I would be really really carful relying on something like that to be unique. I've found that different manufacturers/carriers sometimes put the same # as the value on every device for some of the supposedly unique IDs. Which will cause you major headaches if it turns out that there are thousands of devices out there using the same ID.
That being said, I have no experience working specifically with IMSI so this is just my guess.
Edit: there is no one end all be all "correct" value to use as unique ID as far as I am aware. Here are some links that can give you some ideas though:
Is Secure.ANDROID_ID unique for each device?
Is there a unique Android device ID?
If possible I think you are better off generating your own UUID and storing it yourself. But this of course means that it won't persist through uninstallation of your application (or through SDcard wipe if you choose to store it there)
IMSI is the subscriber identifier and is associated with the SIM, not the phone. If you move the SIM from one phone to another you are moving the IMSI also, so no, it is not unique per phone if this was what you were looking for.
There is an identifier associated with the phone itself - it's the IMEI (International Mobile Equipment Identity). This should be unique per phone - one key use is by operators to detect stolen handsets.
See: http://en.wikipedia.org/wiki/International_Mobile_Equipment_Identity

Categories

Resources