Forum / MIFARE SDK / DESFire getUID with lite SDK
Tagged: GetCardUID
-
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
Before you have access to the DESFire card you always have to authenticate first! See Desfire.authenticate().
MIFARE SDK Team
+ 0 | - 0
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
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
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
-
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.