I need to emulate a DESFire EV1 card on an Android device. However, I'm confused on how to use the Mifare SDK (lite or advanced) with the HCE.
Is that even possible? I need to start the project and I had a lot of researches about how the data are stored and ciphered in the DESFire cards but I ended up with the fact that I need to use Mifare SDK on HCE.
MIFARE DESFire EV1 can have multiple applications (28), and each application can have multiple files (32) of different types (4). The card itself has a PICC master key plus between 1 and 14 keys per application. The keys of each application are used to control access to its files.
MIFARE DESFire® / MIFARE DESFire® EV1 remain the industry standard for ultra-high security badges. As of yet - the MIFARE DESFire® EV1 remains invulnerable to all channels of analysis. The inner workings of the MIFARE DESFire® cards remain under NDA lock and key, making it incredibly difficult to reverse engineer the protocols.
Lab401's MIFARE DESFire® Compatible UID Modifiable Emulator Card is a card that emulates a MIFARE DESFire® card, allowing you to set a custom UID. This card will allow for bypass on systems that authenticate based off the UID.
I have some DESFire + DESFire EV1 + DESFire EV2 cards. I think it would be handy to have at least the common command set, that all DESFire cards support.
First of all, you cannot use the MIFARE SDK to emulate cards. The MIFARE SDK provides reader-side functionality only.
Second, you cannot emulate the whole functionality of MIFARE DESFire (EV1) cards using Android HCE. However, you can emulate parts of the MIFARE DESFire protocols (more specifically, you can only emulate ISO/IEC 7816-4 framing (either ISO command set or wrapped native command set) and only if preceded by an ISO SELECT by AID command). If that's sufficient depends on the requirements of the reader side of your system.
D2760000850100
): You can register your HCE service for the DESFire AID and will be able to receive all wrapped native commands after this AID has been selected.Note that there may be licensing issues if you emulate MIFARE DESFire cards.
MIFARE Classic cannot be emulated in HCE because it works directly on top of ISO 14443-3. HCE emulates the higher layer, ISO 14443-4. But that's the layer where MIFARE DESFire is implemented, so yes it can be done. I have not done it myself but I know at least one company that has made it work, and probably there are several.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With