Skip to content

How to communicate with the external Secure Element for Android 8.1+ devices

On Famoco devices, you can find the following Secure Elements (SE):

Secure Element name Purpose
SIM1 This is the SIM 1, only advanced user can send data to the SIM card, with a lot of limitation, it is not recommended to communicate with the SIM card.
SIM2 This is the SIM 1, only advanced user can send data to the SIM card, with a lot of limitation, it is not recommended to communicate with the SIM card.
eSE1 This is the embedded Secure Element
AT901 This is the SAM (external Secure Element inserted in the SAM slot)

The SmartCard API is a reference implementation of the SIMalliance Open Mobile API specification that enables Android applications to communicate with Secure Elements, e.g. SIM card, embedded Secure Elements, Mobile Security Card or others.

The interface of the library is kept platform independent whereas the SmartcardService implementation is Android-specific.

The SmartCard API provides functionality to list and select the supported Secure Elements, open a communication channel to a dedicated Secure Element application and transfer APDUs to such. No applet selection or channel management APDU functions are allowed as this might cause security problems. Also, no card on/off functions are available in contrast to PC/SC.

Even if the information is a bit outdated, you can find additionnal details on this website

Prerequisites

  • Android Studio development IDE
  • Basic understanding of the Android development platform.
  • Basic knowledge of smart card communication

Library binary

org.simalliance.openmobileapi.jar

Javadoc

The SmartcardAPI documentation can be found here

Setting up the Environment

The Android Studio development environment needs to be configured in order to use the official SDK from Google as described in the Google documentation.

Steps to create a new Project

  • Use the AndroidStudio wizard to created a new basic app (File->new->newProject)
  • Copy the org.simalliance.openmobileapi library into the libs folder of your project
  • Ensure your build.gradle file contains the following dependency
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
}
  • Add the following permission in your AndroidManifest file
<uses-permission android:name="org.simalliance.openmobileapi.SMARTCARD" />
  • Declare the following library dependency in your AndroidManifest file
<uses-library android:name="org.simalliance.openmobileapi" android:required="true"/>
  • You are now ready to start developing your application

Sample code

The following sample code will help you to start your developements.

SmartcardApiSampleApp_v1.1.0.zip