Android Smart Card Emulator

The Android Smart Card Emulator allows the emulation of a contact-less smart card. The emulator uses Android’s HCE to fetch APDUs from a contact-less reader. The app allows to process the Command APDUs either by delegating them to a remote virtual smart card or by a built-in Java Card simulator. The response APDUs are then returned to the smart card reader.

With the built-in Java Card runtime of jCardSim [1] the app includes the following Applets:

The remote interface can be used together with the Virtual Smart Card, which allows emulating the following cards:

  • Generic ISO-7816 smart card
  • German electronic identity card (nPA)
  • Electronic passport

You may also attach your own simulation to the remote interface by implementing a simple interface through a socket communication.

\input{%(wd)s/bilder/tikzstyles.tex}
\node (reader) {\includegraphics[width=3cm]{%(wd)s/bilder/my_cardreader.pdf}};
\node [below=0cm of reader, kleiner] {Contact-less Reader};
\node (phone) [right=1cm of reader] {\includegraphics[width=3cm]{%(wd)s/bilder/smartphone.pdf}};
\node (app) [at=(phone.center)] {\includegraphics[width=2.8cm, height=4.9cm]{%(wd)s/bilder/ACardEmulator.png}};

\begin{pgfonlayer}{background}
    \draw [rfid] (reader.center) -- (phone.west) ;
\end{pgfonlayer}

Simulate a contact-less Java Card with Android Smart Card Emulator

\input{%(wd)s/bilder/tikzstyles.tex}
\node (reader) {\includegraphics[width=3cm]{%(wd)s/bilder/my_cardreader.pdf}};
\node [below=0cm of reader, kleiner] {Contact-less Reader};
\node (phone) [right=1cm of reader] {\includegraphics[width=3cm]{%(wd)s/bilder/smartphone.pdf}};
\node (app) [at=(phone.center)] {\includegraphics[width=2.8cm, height=4.9cm]{%(wd)s/bilder/ACardEmulator.png}};
\node (vicc) [aktivbox, right=2cm of phone, kleiner] {\texttt{vicc --reversed}};

\begin{pgfonlayer}{background}
    \draw [rfid] (reader.center) -- (phone.west) ;
    \path[linie] (phone) edge node {\includegraphics[width=1.5cm]{%(wd)s/bilder/simplecloud.pdf}} (vicc) ;
\end{pgfonlayer}

Simulate a contact-less smart card with a remote virtual smart card

The Android Smart Card Emulator has the following dependencies:

  • NFC hardware built into the smartphone for HCE
  • Android 4.4 “KitKat” (or newer) or CyanogenMod 11 (or newer)
  • permissions for a data connection (communication with Virtual Smart Card) and for using NFC (communication to the reader); scanning the configuration via QR code requires permission to access the camera
  • Virtual Smart Card installed on the host computer for using the remote interface

For emulating a contact-less smart card with a desktop or notebook, have a look at PC/SC Relay.

Please note that the currently emulated applets are verifying the PIN by transmitting it without any protection between card and terminal. You may want to have a look at Erik Nellesson’s Virtual Keycard [7], which uses the PACE protocol for PIN verification.

Download and Install

The Android Smart Card Emulator is available on F-Droid [8].

Android Smart Card Emulator on F-Droid

To manually compile the app you need to fetch the sources and initialize the submodules:

git clone https://github.com/frankmorgner/vsmartcard.git
cd vsmartcard
# fetch the applets that are in the submodules
git submodule init
git submodule update

We use Android Studio [9] to build and deploy the application. Use File ‣ Open to select vsmartcard/ACardEmulator. Attach your smartphone and choose Run ‣ Run ‘app’.

Question

Do you have questions, suggestions or contributions? Feedback of any kind is more than welcome! Please use our project trackers.