DESFire getUID with lite SDK

Forum / MIFARE SDK / DESFire getUID with lite SDK

Tagged: 

  • 1. December 2014 at 1:20
    hi

    im new to andorid developing and to this API. im trying to change sample app code to read card uid. but it always throws exception. is there some steps needed before using getuid comand?
    + 0  |  - 0

    Re: DESFire getUID with lite SDK

    5. December 2014 at 12:06
    Before you have access to the DESFire card you always have to authenticate first! See Desfire.authenticate().

    MIFARE SDK Team
    + 0  |  - 0

    Re: DESFire getUID with lite SDK

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

    @Override
    protected void onNewIntent(final Intent intent) {

    libInstance.filterIntent(intent, new Nxpnfclibcallback() {

    @Override
    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.

    Robert
    + 0  |  - 0

    Re: DESFire getUID with lite SDK

    8. June 2015 at 6:56
    Hi

    I am having a bit problem with card UID and Android OS. AES Authentication goes ok but after that when I try to GetCardUID (0x51) from card is seems to be crypted?
    I did not find clear answer from documents how to decrypt UID? Is there helper method in lite SDK for this? I am using native commands to get data from card.




    + 0  |  - 0

    Re: DESFire getUID with lite SDK

    8. June 2015 at 11:19
    Samu,

    if you are using APDU commands it is different than using SDK. This Forum section is question related with using the SDK.
    In the SDK, UID shuold be returned in byte[] array. You can convert that using Utilities.dumpBytes(uid); to display as Hex (String) value.

    But with using APDU, you have to use some standard Java byteToString converters or byteToHex converter. Try using that.

    Best,
    David
    + 0  |  - 0
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.