-5

I'm trying to read the content of a Mifare Ultralight card using the NFC contactless reader ACR122U Android SDK.

I am able to get following hex values

01 03 A0 0C 44 03 15 D1 01 11 54 02 65 6E 33 34

But I am unable to get my actual data. Please guide me how to extract byte array from above hex values.

Michael Roland
  • 39,663
  • 10
  • 99
  • 206
  • Just check this link you can achieve that http://www.coderanch.com/t/450379/java/java/Hex-String-byte-array – Piyush Jan 17 '15 at 08:28

1 Answers1

6

So it seems that you read 4 pages starting at page 4 from this MIFARE Ultralight tag. Moreover, the tag seems to be formatted according to the NFC Forum Type 2 Tag Operation specification (available from the NFC Forum website).

A Type 2 Tag contains a series of tag-length-value (TLV) structures:

01 (Tag: Lock Control TLV)
  03 (Length: 3 bytes)
  A0 0C 44 (Value: Information on position and function of lock bytes)
03 (Tag: NDEF Message TLV)
  15 (Length: 21 bytes)
  D101115402656E3334... (Value: NDEF message)

You would have to issue a read command for the next 4 pages to obtain the remaining data of the NDEF message.

For now, we know, that the tag contains an NDEF message starting with

D101115402656E3334

This translates to

D1 (Header byte of record 1)
    - Message begin is set (= first record of an NDEF message)
    - Message end is set (= last record of an NDEF message)
    - Short record flag is set (= Payload length field consists of 1 byte only)
    - Type Name Format = 0x1 (= Type field contains an NFC Forum well-known type)
  01 (Type length: 1 byte)
  11 (Payload length: 17 bytes)
  54 (Type: "T")
  02656E3334... (Payload field)

The payload field of an NFC Forum Text record decodes like this:

02 (Status byte: Text is UTF-8 encoded, Language code has a length of 2 bytes)
656E (Language code: "en")
3334... (Text: "34"...)
Michael Roland
  • 39,663
  • 10
  • 99
  • 206