4

I've started on a project where I have to send commands with APDU interface or OTA interface, from my android project to a JavaCard applet that's on the phone's SIM. I have the AID and a few commandos to start testing the Android app, but i don't know how to select the applet on the card nor how to send the commands on android.

From searching I found this Seek for Android. But I've read that i need to get the Android OS and build it with this api and push it to a device. Doesn't this make my app not able to run on devices without this "custom" Android OS?

Is there any Android or java lib that allows me to communicate with the applet, allowing my app to be available without building a "hacked" Android OS? Or am I wrong on how Seek for Android works?

Thanks for any possible help. I've been cracking my head with this over the last 3 days.

Michael Roland
  • 39,663
  • 10
  • 99
  • 206
Hugo Alves
  • 1,555
  • 2
  • 18
  • 41
  • Do you did that? How did you used OTA interface? Does we need any special device to send OTA messages or we can simply use another phone to send them? – Ebrahim Ghasemi Mar 30 '15 at 15:04

3 Answers3

4

AFAIK regular apps on Android can not communicate with a SIM card. This is a fact and can not be circumvented on a non-custom Android build.

Only system apps like the SIM-Toolkit-App can communicate with the SIM card using the Radio Interface Layer (RIL). But this interface might be tightened down to SIM-Toolkit usage (have not checked it).

The only alternative is using "non-standard Smartcards" like those integrated in an SD-Card or external NFC cards.

Robert
  • 39,162
  • 17
  • 99
  • 152
  • thank you, for the info. I was fearing something like this. The project has change a little and is now only to target a specific phone luckly it's one that comes with the seek api integrated :) – Hugo Alves Jul 18 '13 at 08:10
  • 3
    This is not quite true. There is no standard API in the Android SDK, but it can be provided as an add-on (proprietary) library. Most new Samsung phones provide it out-of-the box, there is no need for 'hacked up' OS. As long as you have the necessary permissions, you can access the SIM card. You can setup your distribution channel so that your app is only distributed to devices that have the required add-on libraries. – Nikolay Elenkov Sep 17 '13 at 17:49
  • Also, ability to communicate with the SIM depends on the baseband and proprietary RIL libraries, so simply installing a ROM with SEEK patches applied is not enough to enable SIM communication from apps. – Nikolay Elenkov Sep 17 '13 at 17:50
3

With the new API in Android 5.0 you can do it. Of course your app needs a special privilege. Either install your app as system app to gain MODIFY_PHONE_STATE permission or install an ARA-M applet in your UICC as defined in GlobalPlatform to get carrier privileges

kimikanen
  • 31
  • 3
1

It is possible with kind of a hack. In the SMS Manager Class there are private methods to update SMS records, those methods are accessible via Java Reflections. If you update EF SMS OTA encoded, the SIM will be interpret this just like an OTA update. If the Applet on the SIM is accessible via its TAR via OTA, it is also accessible via Android-SMS updates.