Skip to content

[UNMAINTAINED] Web SCAPI

Marc Obrador edited this page Jul 24, 2015 · 1 revision

Introduction

The SIMalliance OpenMobile API can get integrated in the Android platform with the SmartCard API. Android using the shared library can get access to Secure Elements using the interfaces defined in the OMAPI spec.

However, browser based applications gain importance with new HTML5 features and the benefit that browser applications are platform independent compared to native applications for the mobile device. Making the OpenMobile API available in the browser provides the possibility to create security aware applications using features of Secure Elements in HTML applications as well.

The WebScapi (SmartCard API for the Web) project is still a very early prototype but will get extended over the time.

Building

  • add the SmartCard API patch file(s) as normal to build the system
  • download the webscapi-1_0_0.tgz and extract the content
[webscapi-1_0_0.tgz](http://seek-for-android.googlecode.com/files/webscapi-1_0_0.tgz)
  • apply the WebScapi patch with
    $ cd <ANDROID_ROOT_DIR>
    $ patch -p1 < <path_to_my_patches>/webscapi.patch
  • build & flash the system as normal...not yet...

Building Issues

When the WebScapi is compiled with make and flashed on a device the corresponding files are included in the system.img properly but when accessing the browser plugin it will cause an exception similar to:
E/dalvikvm(  667): Dex cache directory isn't writable: /data/dalvik-cache
I/dalvikvm( 667): Unable to open or create cache for /system/app/WebScapi.apk (/data/dalvik-cache/system@app@WebScapi.apk@classes.dex)
E/PluginManager( 667): Can't find plugin's class: com.gieseckedevrient.android.webscapi.TransportPlugin
E/browser ( 667): Console: Uncaught TypeError: Object #<HTMLObjectElement> has no method 'createSEService' file:///sdcard/WebScapi.js:23
This looks like a browser plugin needs to be in odex format, either when building the platform or through dalvik-cache?!

Workarounds

  • either build the system with odex files:
    $ make -jX WITH_DEXPREOPT=true 
    and flash normally or
  • install the browser plugin APK like a normal application:
    $ adb remount
    $ adb shell rm /system/app/WebScapi.apk
    $ cd <ANDROID_ROOT_DIR>
    $ adb install out/target/product/<platform>/system/app/WebScapi.apk
    and reboot.
    Even now, it turned out that the current implementation is only accessible when builing the ENG target, USERDEBUG & USER will not work.
    Ensure to compile with lunch full_crespo-eng

Using

For a simple test, push the small HTML demo on the device and open it in the Android browser:
$ adb push packages/apps/WebScapi/html/index.html /sdcard/
$ adb push packages/apps/WebScapi/html/WebScapi.js /sdcard/

Within the browser, open the URI

file:///sdcard/index.html

The PerformanceTester application will be converted to HTML in a next step.

Creating an application

Include the Javascript code from WebScapi.js as provided in the sample application, create an instance of SEService and use all interfaces of the OpenMobile API as is native Android applications.

Developed and tested with android-4.0.3_r1 with Nexus S and SIM & SmartMX as Secure Element.

Clone this wiki locally