Forum Replies Created

  • Re: Re: DESFire getUID with lite SDK

    22. January 2015 at 15:10
    in reply to: DESFire getUID with lite SDK
    An alternative is to use the Android getId function before you connect to the card with the NXP MIFARE SDK. So, something like this:

    protected void onNewIntent(final Intent intent) {

    libInstance.filterIntent(intent, new Nxpnfclibcallback() {

    public void onDESFireCardDetected(final DESFire objDESFire) {
    mDESFire = objDESFire;

    String action = intent.getAction();
    if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) {
    try {
    Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
    byte[] uid = tag.getId();

    ... then use the byte array with the Card's UID in here...

    I sometimes use the DESFire Card UID as a diversification input, so reading the Card's UID like this before I authenticate access to an application file on the DESFire card is useful.

    + 0  |  - 0

    Re: Re: DESFire Authentication with Advanced SDK

    22. January 2015 at 15:00
    in reply to: DESFire Authentication with Advanced SDK
    Let me answer my own question!!

    To use the SDK to read data from a DESFire EV1 Card:

    Step 1: Create a soft Key Store into which you place your Card Key. Here, I have my byte array key in MY_CARD_KEY:
    private IKeyStore ks = null;
    ks = KeyStoreFactory.getInstance().getSoftwareKeyStore();
    ks.formatKeyEntry(0, IKeyConstants.KeyType.KEYSTORE_KEY_TYPE_2K3DES);
    ks.setKey(0, (byte) 0, IKeyConstants.KeyType.KEYSTORE_KEY_TYPE_2K3DES, MY_CARD_KEY);

    Step 2 : Connect to the Card and Select the Application AID using the mDESFire object from the @Override of onDESFireCardDetected()

    Step 3 : Authenticate using a reference to the soft Key Store Key we set up earlier and on the Card Key we are using. Here, I use Card Key 1:
    mDESFire.authenticate(AuthType.Native, 0, (byte) 0, 1, (byte)IKeyConstants.DIV_OPTION_NODIVERSIFICATION, null);

    Step 4 : Read Data (here I read 32 bytes from File 1)
    mDESFire.readData(1, 0, 32, DESFire.CommunicationType.Enciphered, 32));

    Step 5 : Tidy Up

    + 0  |  - 0
Viewing 2 posts - 1 through 2 (of 2 total)