Class Mifare
Class encapsulating access to a Mifare classic 1K/4K card
Defined in: mifare.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Mifare(card)
Create a Mifare card object
|
Field Attributes | Field Name and Description |
---|---|
<static> |
Mifare.KEY_A
Identifier for Key A
|
<static> |
Mifare.KEY_B
Identifier for Key B
|
<static> |
Mifare.PUBLICKEYS
Mifare Public Key Values
|
Method Attributes | Method Name and Description |
---|---|
authenticate(block, keytype, keyid)
Perform authentication procedure using General Authenticate command as defined in PCSC Part 3, chapter 3.2.2.1.6
|
|
<static> |
Mifare.crc8(data)
Calculate CRC-8 checksum
Based on code from nfc-tools.
|
getUID()
Read UID using Get Data command as defined in PCSC Part 3, chapter 3.2.2.1.3
FEIG readers require Le='04' to automatically switch to Mifare if the card supports both T=CL and Mifare. |
|
loadKey(keyid, key)
Load key value into reader using Load Key command as defined in PCSC Part 3, chapter 3.2.2.1.4
The ACR 122U contactless reader supports key ids 0x00 and 0x01 The Omnikey cardman 5321 reader supports key ids 0x00 to 0x1F The ACR 122U contactless reader supports key ids 0x00 and 0x01 The method supports the SCM SDI010 contactless reader which uses a proprietary LOAD KEY APDU with preset key identifier 0x60 and 0x61. |
|
newSector(no)
Create a sector object bound to the current Mifare instance
|
|
readBlock(block)
Read a block using the Read Binary command as defined in PCSC Part 3, chapter 3.2.2.1.8
|
|
updateBlock(block, data)
Update a block using the Update Binary command as defined in PCSC Part 3, chapter 3.2.2.1.9
|
- Parameters:
- {Number} block
- the block to authenticate against
- {Number} keytype
- must be either Mifare.KEY_A or Mifare.KEY_B
- {Number} keyid
- the key id of the key in the reader
- Returns:
- true if authentication successfull
- Parameters:
- {ByteString} data
- the data to calculate the checksum for
- Returns:
- the crc checksum
FEIG readers require Le='04' to automatically switch to Mifare if the card supports both T=CL and Mifare.
- Returns:
- the 4 byte UID
The ACR 122U contactless reader supports key ids 0x00 and 0x01
The Omnikey cardman 5321 reader supports key ids 0x00 to 0x1F
The ACR 122U contactless reader supports key ids 0x00 and 0x01
The method supports the SCM SDI010 contactless reader which uses a proprietary LOAD KEY APDU with preset key identifier 0x60 and 0x61. This command is activated if keyid is 0x60 or 0x61.
- Parameters:
- {Number} keyid
- the key identifier under which the key should be refered to in the reader
- {ByteString} key
- the 6 byte key value
- Parameters:
- {Number} no
- the sector number
- Parameters:
- {Number} block
- the block to read, starting at 0 for the first block in the first sector.
- Returns:
- the 16 byte block content read from the card
- Parameters:
- {Number} block
- the block to read, starting at 0 for the first block in the first sector.
- {ByteString} data
- the 16 bytes of the data block to write