JAndroidCard - martinpaljak/jcardsim GitHub Wiki
"soft JavaCard" for Android HCE
[!NOTE] This is just an idea, maybe a student will pick it up.
Step 1. Prep
- you have a standard JavaCard applet
YourApplet
that replies "Hello, World!" to a simple APDU. - you compile this into a unstripped .cap file with
ant-javacard
(step before CAP conversion) - use
java -jar jandroidcard.jar -install YourApplet.cap -params ...
much like with GlobalPlatformPro to convert the .jar to .dex and add install manifest. You will end up with a "YourApplet.zip" file (format/contents/extension to be clarified)
Step 2. Run
- you open the "JAndroidCard" app
- it will have a single button "select applet"
- maybe some more tunable checkboxes like "persist card data" etc
- you click it, browse to the generated YourApplet.zip file, and open it
- JAndroidCard sets up jcardsim simulator instance with the install manifest data and hooks up the defined AID-s with the system
- JAndroidCard will pipe APDU-s between HCE and Simulator
- you can now tap the phone to a NFC reader to use the phone just like a JavaCard that has YourApplet installed.
- caveats about data and applet_lifecycle==app_lifecycle, background/foreground routing etc apply.
Step 3. Profit!
- mostly for the lulz
- maybe route some crypto ops in the jcardsim JC API to Keychain etc
[!NOTE] This is not unlike https://frankmorgner.github.io/vsmartcard/ACardEmulator/README.html or https://web.archive.org/web/20240927032835/https://github.com/martinpaljak/mobiil-idkaart but the idea here is to make a single Android app and dynamically load applets into it. And the possible hooking up of the simulator to Keychain backends or other similar shenanigans.