com.datecs.api.rfid
Class ISO14443Card

java.lang.Object
  extended by com.datecs.api.rfid.ContactlessCard
      extended by com.datecs.api.rfid.ISO14443Card

public class ISO14443Card
extends ContactlessCard

A class that represents ISO14443 cards.


Field Summary
 
Fields inherited from class com.datecs.api.rfid.ContactlessCard
afi, atqa, blockSize, capacity, CARD_FELICA, CARD_ISO14443A, CARD_ISO14443B, CARD_ISO15693, CARD_MIFARE_CLASSIC_1K, CARD_MIFARE_CLASSIC_4K, CARD_MIFARE_DESFIRE, CARD_MIFARE_MINI, CARD_MIFARE_PLUS, CARD_MIFARE_ULTRALIGHT, CARD_MIFARE_ULTRALIGHT_C, CARD_ST_SRI, CARD_UNKNOWN, channel, dsfid, hyatt64Card, maxBlocks, sak, type, uid
 
Constructor Summary
ISO14443Card(RC663 module)
          Constructs a new instance of this class.
 
Method Summary
 void authenticate(char type, int address, byte[] key)
          Authenticate mifare card block with direct key data.
 void authenticate(char type, int address, int keyIndex)
          Authenticate mifare card block with previously stored key.
 boolean initialize()
          Initialize card.
 void loadKey(int keyIndex, char type, byte[] key)
          Store key in the internal module memory for later use.
 byte[] read16(int address)
          Reads one block of data from Mifare Classic/Ultralight cards.
 void ulcAuthenticate(byte[] key)
          Performs 3DES authentication of Mifare Ultralight C card using the given key.
 void ulcSetKey(byte[] key)
          Sets the 3DES key of Mifare Ultralight C cards.
 void write16(int address, byte[] data)
          Writes one block of data to Mifare Classic/Ultralight cards.
 
Methods inherited from class com.datecs.api.rfid.ContactlessCard
getModule, waitRemove
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ISO14443Card

public ISO14443Card(RC663 module)
Constructs a new instance of this class.

Parameters:
module - The instance of RC663 module.
Method Detail

initialize

public boolean initialize()
                   throws java.io.IOException
Initialize card.

Returns:
On success returns true, otherwise returns false.
Throws:
java.io.IOException - if an I/O error occurs.

loadKey

public void loadKey(int keyIndex,
                    char type,
                    byte[] key)
             throws java.io.IOException,
                    RFIDException
Store key in the internal module memory for later use.

Parameters:
keyIndex - The index of the key, you can have up to 8 keys stored (0-7).
type - The key type, either 'A' or 'B'.
key - The 6 bytes key.
Throws:
java.io.IOException - If an I/O error occurs.
RFIDException - if an RF663 error occurs.

authenticate

public void authenticate(char type,
                         int address,
                         byte[] key)
                  throws java.io.IOException,
                         RFIDException
Authenticate mifare card block with direct key data.

This is less secure method, as it requires the key to be present in the program, the preferred way is to store a key once in a secure environment and then authenticate using the stored key.

Parameters:
type - The key type, either 'A' or 'B'.
address - The address of the block to authenticate.
key - The 6 bytes key.
Throws:
java.io.IOException - If an I/O error occurs.
RFIDException - if an RF663 error occurs.

authenticate

public void authenticate(char type,
                         int address,
                         int keyIndex)
                  throws java.io.IOException,
                         RFIDException
Authenticate mifare card block with previously stored key.

This the preferred method, as no key needs to reside in application.

Parameters:
type - The key type, either 'A' or 'B'.
address - The address of the block to authenticate.
keyIndex - The index of the stored key, you can have up to 8 keys stored (0-7).
Throws:
java.io.IOException - If an I/O error occurs.
RFIDException - if an RF663 error occurs.

read16

public byte[] read16(int address)
              throws java.io.IOException,
                     RFIDException
Reads one block of data from Mifare Classic/Ultralight cards.

A read operation gets 16 bytes of data.

Parameters:
address - The address of the block to read.
Returns:
The 16 byte data.
Throws:
java.io.IOException - If an I/O error occurs.
RFIDException - if an RF663 error occurs.

write16

public void write16(int address,
                    byte[] data)
             throws java.io.IOException,
                    RFIDException
Writes one block of data to Mifare Classic/Ultralight cards.

A write operation stores 16 bytes of data.

Parameters:
address - The address of the block to write.
data - The data to write, must be multiple of the block size (16 bytes).
Throws:
java.io.IOException - If an I/O error occurs.
RFIDException - if an RF663 error occurs.

ulcSetKey

public void ulcSetKey(byte[] key)
               throws java.io.IOException,
                      RFIDException
Sets the 3DES key of Mifare Ultralight C cards.

Parameters:
key - The 16 bytes 3DES key to set.
Throws:
java.io.IOException - If an I/O error occurs.
RFIDException - if an RF663 error occurs.

ulcAuthenticate

public void ulcAuthenticate(byte[] key)
                     throws java.io.IOException,
                            RFIDException
Performs 3DES authentication of Mifare Ultralight C card using the given key.

Parameters:
key - The 16 bytes 3DES key to authenticate with.
Throws:
java.io.IOException - If an I/O error occurs.
RFIDException - if an RF663 error occurs.