Skip to content

FYI: Solution to the DESfire APDU problem #2

@micolous

Description

@micolous

Looking over your StackOverflow question, it is mentioned the major issue for emulating DESfire is the three flavours of the protocol: "native", "wrapped native" and "pure ISO7816", and that in order for an existing DESfire deployment to work, you'd need to talk one of the latter two protocols and send an ISO7816 SELECT APPLICATION first.

Since your post, there now are a small number of organisations which have rolled out support for DESFire on Android HCE using an SDK called "MIFARE 2GO". This finally gives an opportunity to discover what a real-world DESfire+HCE deployment looks like.

It looks like that these implementations have ISO7816 AIDs prefixed with A000000396 by convention.

There's two ways to get the "correct" AIDs for a particular deployment:

  1. Log / sniff the SELECT APPLICATION commands from a "legitimate" reader, or,

  2. Pull the Android manifest from a HCE application, and look for the AIDs in the manifest.

Once you've sent a SELECT APPLICATION, it appears that you can talk ISO7816-wrapped DESfire commands just fine.

If I understand the status of things correctly, this should mean that it's possible for this project to actually work, and emulate a card in the DESfire-recommended way.

It should also be possible to proxy card communication using two Android devices, provided that the reader unit supports connection with the ISO7816 SELECT APPLICATION command, one of your Android devices does HCE, and then just plumb the commands over the network.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions