Hallo,
> What exactly is low level access?
With low-level access (as compared to APDU based access) I mean some
vendor specific (proprietary) protocol according to the ISO/IEC 14443-3
standard. Thus, instead of sending high-level APDU commands a more
simple protocol is used (such a protocol is for example the MIFARE
Ultralight and the MIFARE Classic command-set).
> How do I send/receive nfcA/nfcB commands then?
For NfcA (e.g. MIFARE Ultralight) you would simply retrieve an NfcA object:
NfcA myTag = NfcA.getTag(tag);
And then transceive low-level commands with transceive() method. E.g.
byte[] data = myTag.transceive(new byte[]{ (byte)0x30, (byte)0x00 });
would retrieve the first 16 bytes of data from an MIFARE Ultralight tag.
But as you suggested you want to transfer APDUs, instead of getting an
NfcA object you would want to get an IsoDep object for the tag. This
object wraps an APDU-based (ISO/IEC 14443-4 & ISO/IEC 7816-4) connection:
IsoDep myCard = IsoDep.getTag(tag);
The transceive() method then allows you to directly transmit command
APDUs to the contactless smart card and returns the response APDU:
byte[] response = myCard.transceive(command);
Where command could be, for instance, a SELECT(file by DF name) command.
The following command would select the ICAO electronic passport
application (AID A0000002471001):
byte[] command = new byte[]{
(byte)0x00, /* CLA = 00 (first interindustry command set) */
(byte)0xA4, /* INS = A4 (SELECT) */
(byte)0x04, /* P1 = 04 (select file by DF name) */
(byte)0x0C, /* P2 = 0C (first or only file; no FCI) */
(byte)0x07, /* Lc = 7 (data/AID has 7 bytes) */
/* AID = A0000002471001: */
(byte)0xA0, (byte)0x00, (byte)0x00, (byte)0x02,
(byte)0x47, (byte)0x10, (byte)0x01
};
As a response you would get e.g. status code 9000 if the applet was
found on the card.
Best regards,
Michael
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en