Modifications

Sauter à la navigation Sauter à la recherche
4 372 octets ajoutés ,  9 septembre 2015 à 11:03
Ligne 228 : Ligne 228 :     
=== Mifare Application Directory 1 (MAD1) ===
 
=== Mifare Application Directory 1 (MAD1) ===
 +
{{traduction}}
 +
 +
'''MAD1 can be used in any Mifare Classic card''' regardless of the size of the EEPROM, although if it is used with cards larger than 1KB only the first 1KB of memory will be accessible for NDEF records.
 +
 +
The MAD1 is stored in the Manufacturer Sector (Sector 0x00) on the Mifare Classic card.
 +
 +
=== Mifare Application Directory 2 (MAD2) ===
 +
MAD2 can only be used on Mifare Classic cards with '''more than 1KB of storage''' (Mifare Classic 4K cards, etc.). It is '''NOT''' compatible with cards containing only 1KB of memory!
 +
 +
The MAD2 is stored in sectors 0x00 (the Manufacturer Sector) and 0x10.
 +
 +
=== MAD Sector Access ===
 +
The sectors containing the MAD1 (0x00) and MAD2 (0x00 and 0x10) are protected with a KEY A and KEY B (if you're not familiar with this concept, consult the Mifare Classic summary elsewhere in the PN532/NFC wiki). To ensure that these sectors can be read by any application, the following common KEY A should always be used:
 +
 +
<nowiki>  Public KEY A of MAD Sectors
 +
  CLE A publique des secteurs MAD
 +
  ---------------------------------------------------
 +
  BYTE 0  BYTE 1  BYTE 2  BYTE 3  BYTE 4  BYTE 5
 +
  0xA0    0xA1    0xA2    0xA3    0xA4    0xA5</nowiki>
 +
 +
The MAD sector may optionally be write-protected using KEY B if you wish to limit the ability of customers to modify the card contents. The public KEY A will ensure that they can always read the data.
 +
 +
=== Storing NDEF Messages in Mifare Sectors ===
 +
NDEF messages/records may be stored in any sector of the Mifare card, other than the sector(s) use by the MAD or sectors beyond the 1K range if a MAD1 table is used.
 +
 +
When a sector is used to store NDEF records, it is referred to as an NFC Sector. As with the MAD Sector(s) described above, these sectors must always be accessible in at least read-only mode, and as such a common public KEY A also exists for NFC Sectors, though it is not the same KEY A used in the MAD sector(s):
 +
 +
<nowiki>  Public KEY A of NFC Sectors
 +
  CLE A plubique des secteurs NFC
 +
  ---------------------------------------------------
 +
  BYTE 0  BYTE 1  BYTE 2  BYTE 3  BYTE 4  BYTE 5
 +
  0xD3    0xF7    0xD3    0xF7    0xD3    0xF7</nowiki>
 +
 +
In order to store an NDEF Message on the Mifare Classic card, the message needs to be wrapped inside something called a TLV Block. The basic structure of a '''TLV''' Block is described below.
 +
 +
=== TLV Blocks ===
 +
TLV is an abbreviation for three different fields: T for Tag Field, L for Length Field and V for Value Field. A TLV Block consist of one or more bytes, depending on which of these three fields is present. Note that the TLV Block will always be at least one byte since the T Field is mandatory in every case.
 +
 +
==== Tag Field ====
 +
The Tag Field (or T Field) is the only mandatory field, and uses a single-byte to identify the type of TLV block accordingly to a pre-determined table of values:
 +
 +
<nowiki>TLV Block Types
 +
 
 +
  Block Type    Value  Description
 +
  ------------- -----  --------------------------------------
 +
  NULL          0x00  These blocks should be ignored
 +
  NDEF Message  0x03  Block contains an NDEF message
 +
  Proprietary  0xFD  Block contains proprietary information
 +
  Terminator    0xFE  Last TLV block in the data area</nowiki>
 +
 +
==== Length Field ====
 +
The Length Field (or L Field) contains the size (in bytes) of the value field. The Length Field can be organised in two different ways, using either one or three bytes.
 +
 +
The one byte format simple contains a single byte value from 0x00..0xFF.
 +
 +
The three byte format consists of the following format:
 +
<nowiki>  Byte 0:      Always 0xFF to indicate that we are using the three byte format
 +
  Byte 1..2:    Can be a value between 0x00FF and 0xFFFE</nowiki>
 +
 +
Both the one byte and three byte format must be supported for NFC Forum and NDEF compatability.
 +
 +
==== Value Field ====
 +
The Value Field (or V Field) is only present if the Length Field (described above) is present and not equal to 0x00. If the Length Field is not equal to 0, the Value Fields will contain N bytes of data in the format indicated by the T Field above.
 +
 +
The value field is where the payload (an '''NDEF Message''', for example) is stored.
 +
 +
==== Terminator TLV ====
 +
The Terminator TLV is the last TLV block in the data area, and consist of a single byte: 0x0FE (see the TLV Block Type table above). This TLV Block in mandatory.
    
{{traduction}}
 
{{traduction}}
29 917

modifications

Menu de navigation