All Projects → jekkos → android-hce-desfire

jekkos / android-hce-desfire

Licence: other
A HCE software implementation of the NXP Desfire NFC protocol in an Android app (to be used with Cyanogenmod HCE patch)

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to android-hce-desfire

Vsmartcard
umbrella project for emulation of smart card readers or smart cards
Stars: ✭ 404 (+1246.67%)
Mutual labels:  emulation, nfc
nfcproxy
用两个安卓手机的nfc功能截取iso14443交互数据 fork by https://github.com/nfcproxy/NFCProxy
Stars: ✭ 30 (+0%)
Mutual labels:  nfc, hce
Yuzu
Nintendo Switch Emulator
Stars: ✭ 17,405 (+57916.67%)
Mutual labels:  emulation
ChameleonMini
The ChameleonMini is a versatile contactless smartcard emulator compliant to NFC. The ChameleonMini was first developed by KAOS. This is NOT the official repo for KAOS's ChameleonMini. For further information see the Getting Started Page
Stars: ✭ 350 (+1066.67%)
Mutual labels:  nfc
tripreader-data
“读卡识途”项目公开数据
Stars: ✭ 58 (+93.33%)
Mutual labels:  nfc
Xlmmacrodeobfuscator
Extract and Deobfuscate XLM macros (a.k.a Excel 4.0 Macros)
Stars: ✭ 243 (+710%)
Mutual labels:  emulation
scemu
x86 malware emulator
Stars: ✭ 150 (+400%)
Mutual labels:  emulation
Gamestarter
🎮 Retrogaming kodi add-on repository for LibreELEC
Stars: ✭ 222 (+640%)
Mutual labels:  emulation
poke.AI
An experimental AI that plays the 3rd gen Pokemon games - Winner of Judge's Choice Award for NUS Orbital Project
Stars: ✭ 39 (+30%)
Mutual labels:  emulation
nfc-tags
No description or website provided.
Stars: ✭ 15 (-50%)
Mutual labels:  nfc
easypay
NFC smart cards and payment terminals in Nigeria
Stars: ✭ 41 (+36.67%)
Mutual labels:  nfc
resid-rs
Port of reSID, a MOS6581 SID emulator engine, to Rust
Stars: ✭ 25 (-16.67%)
Mutual labels:  emulation
core
UBIC: The crypto currency providing UBI for the masses using the E-Passport
Stars: ✭ 37 (+23.33%)
Mutual labels:  nfc
ares
ares is a cross-platform, open source, multi-system emulator, focusing on accuracy and preservation.
Stars: ✭ 465 (+1450%)
Mutual labels:  emulation
Openswe1r
An Open-Source port of the 1999 Game "Star Wars Episode 1: Racer"
Stars: ✭ 236 (+686.67%)
Mutual labels:  emulation
LudOS
Just enough OS for libretro using the Ludo frontend on a LibreELEC 9.2 base
Stars: ✭ 36 (+20%)
Mutual labels:  emulation
Vigem
Virtual Gamepad Emulation Framework
Stars: ✭ 225 (+650%)
Mutual labels:  emulation
Booma.Proxy
Collection of C#/.NET libraries for communication, understanding and emulating Phantasy Star Online Blue Burst. Both client and server.
Stars: ✭ 30 (+0%)
Mutual labels:  emulation
RGB
RGB (Rust Game Boy) is a simple emulator for the original game boy
Stars: ✭ 19 (-36.67%)
Mutual labels:  emulation
Open-Home-Automation
Open Home Automation with Home Assistant, ESP8266/ESP32 and MQTT
Stars: ✭ 905 (+2916.67%)
Mutual labels:  nfc

Project Inception

This project is an incomplete software implementation of the Mifare Desfire protocol for HCE on Android. The app has to be used with the original HCE patch of Doug Yeager introduced in CyanogenMod 9. Most of the initial code has now been removed from CyanogenMod and thus a system level patch is needed to make the whole work.

  • App will only work on phones with PN544 NXP chip (which are HTC One M7, Nexus S, ..)
  • A patched NFC.apk will need to be built from the packages_Nfc_apps repository I cloned here on github
  • A patched Android framework.jar should be built the android base framework
  • libnfc-nxp should contain the needed fixes in CM12 (no changes required)

Standard HCE emulation in Android 4.4 does not give complete control over APDUs sent. Desfire has 3 communication modes which are native, wrapped and iso14443-4.

A standard android HCE app would be able to cope with a wrapped protocol implementation after removing the AID routing functionality using an xposed framework library hook. However for my POC I found the hardware to communicate using native commands and thus needed to have full control over APDUs which at that time was only feasible with the original CM HCE patch.

Project state

The code contains some testcases that verify a couple of different basic communication scenario's with a DesFire card. Doug Yeager's patch was ported to Android 5 which enabled a pn544 to communicate with off the shelve NFC physical security system at Capgemini Belgium's premises. A talk was given at Capgemini Belgium in 2015 to present the POC.

You can detect a phone as a Mifare Tag by using an libnfc compqatible reader with patched libfreefare. One working example here includes the mifare get info command, which can request some general info fields from the Android application and show them in a linux terminal. To reproduce this case it's best to use the pn532-tamashell binary that comes by default with libfreefare.

In that case the raw command bytes for DesFire get info can be issued which should normally yield a valid response from the Android app.

LIBNFC_LOG_LEVEL=3 cat << EOF | pn53x-tamashell \
4a 01 00 \
40 01 00 a4 04 00 07 d2 76 00 00 85 01 00 00  \
40 01 00 00 60 00 00 00 \
40 01 00 00 AF 00 00 00 \
40 01 00 00 AF 00 00 00 \
EOF

References

This project is based on the following work

  • Kevin Valk's thesis on HCE in Android and his work on porting JavaCard applets to the Android platform
  • Original code from an academic paper on porting DesFire to JavaCard. This code contains an implementation for the legacy protocols only (non AES)
  • Libfreefare code which contains all the newer DesFire protocol implementation details.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].