How to use the ISO7816 select command with DESfire Ev1 card?

I have a version of DESfire Ev1 version 1.3, and I'm trying to select a file using apdu style ISO7816.

I have one file using A0 A1 A2 , and I can select it using both native and wrapped modes:

Native:

 -> 5A A0 A1 A2 <- 00 

wrapped:

 -> 90 5A 00 00 03 A0 A1 A2 00 <- 91 00 

However, if I try to select it using the ISO7816 style, I always get an error not found by the file:

ISO7816:

 -> 00 A4 04 00 03 A0 A1 A2 00 -> 6A 82 

When using ISO apdu, is the AID in a different format? How can I select this AID using this?

+3
nfc smartcard mifare
source share
1 answer

From the docs:

This APDU selects an ISO application according to its ISO Identifier Application (AID). ISO AID DESFire - "0xD2 76 00 00 85 01 00". Full ISO identification must be passed; partial selection is NOT supported. Other ISO AIDs not supported by DESFire

This, apparently, contradicts the fact that you have AID 0xA0 0xA1 0xA2 .

It looks like you need to send:

 [CLA] [INS] [P1] [P2] [Len(AID)] [AID] 

Thus:

0x00 0xA4 0x04 0x00 0x07 0xD2 0x76 0x00 0x00 0x85 0x01 0x00

** EDIT **

Try the ISO SELECT DIRECTORY instead:

This APDU selects a DESFire application with its three-byte DESFire Application Identifier (DESFire AID) ....

The functionality of the ISO SELECT DIRECTORY command is compatible with the DESFire Select Application command.

So:

 0x00 0xA4 0x04 0x00 0x03 0xA0 0xA1 0xA2 

(This was on the next page, and probably exactly what you wanted in the first place.)

I think this is identical to what you had, minus NUL at the end.

0
source share

All Articles