public interface MifareCard extends MemoryCard
PROTOCOL_RFCARD_TYPE_A, PROTOCOL_RFCARD_TYPE_B, PROTOCOL_T_0, PROTOCOL_T_1, PROTOCOL_UNKNOWN, STATUS_ABSENT, STATUS_CONNECTED, STATUS_DISCONNECTED
Modifier and Type | Method and Description |
---|---|
boolean |
decreaseValue(int sectorIndex,
int blockOfSector,
int value)
Decreases E-Wallet data value.
|
boolean |
increaseValue(int sectorIndex,
int blockOfSector,
int value)
Increases E-Wallet data value.
|
byte[] |
readBlock(int sectorIndex,
int blockOfSector)
Reads the data in some block.
|
MoneyValue |
readValue(int sectorIndex,
int blockOfSector)
Reads data from E-Wallet.
|
byte[] |
transmit(byte[] apdu,
int operation)
Transmit command of level 3 and get the response.
|
boolean |
verifyKeyA(int sectorIndex,
byte[] key)
Authenticates a sector with key A.
|
boolean |
verifyKeyB(int sectorIndex,
byte[] key)
Authenticates a sector with key B.
|
void |
writeBlock(int sectorIndex,
int blockOfSector,
byte[] buffer)
Writes the data to block.
|
void |
writeValue(int sectorIndex,
int blockOfSector,
MoneyValue value)
Writes the data to E-Wallet.
|
getCardStatus, getID, getProtocol
boolean verifyKeyA(int sectorIndex, byte[] key) throws DeviceException
Successful authentication of a sector with key A enables other I/O operations on that sector. The set of operations granted by key A key depends on the ACL bits set in that sector. For more information see the MIFARE specification on .
A failed authentication attempt causes an implicit reconnection to the tag, so authentication to other sectors will be lost.
This is an I/O operation and will block until complete. It must not be called from the main application thread. A blocked call will be canceled with IOException if close() is called from another thread.
sectorIndex
- The sector number of the mifare cardkey
- 6-byte authentication keytrue
Authenticates success,false
Authenticates fail.DeviceException
- for the standard reasons that are documented in
DeviceException
.boolean verifyKeyB(int sectorIndex, byte[] key) throws DeviceException
Successful authentication of a sector with key B enables other I/O operations on that sector. The set of operations granted by key A key depends on the ACL bits set in that sector. For more information see the MIFARE specification on .
A failed authentication attempt causes an implicit reconnection to the tag, so authentication to other sectors will be lost.
This is an I/O operation and will block until complete. It must not be called from the main application thread. A blocked call will be canceled with IOException if close() is called from another thread.
sectorIndex
- The sector number of the mifare cardkey
- 6-byte authentication keytrue
Authenticates success,false
Authenticates fail.DeviceException
- for the standard reasons that are documented in
DeviceException
.byte[] readBlock(int sectorIndex, int blockOfSector) throws DeviceException
sectorIndex
- the sector indexblockOfSector
- the block index with sectorDeviceException
- for the standard reasons that are documented in
DeviceException
.void writeBlock(int sectorIndex, int blockOfSector, byte[] buffer) throws DeviceException
sectorIndex
- blockOfSector
- buffer
- DeviceException
- for the standard reasons that are documented in
DeviceException
.void writeValue(int sectorIndex, int blockOfSector, MoneyValue value) throws DeviceException
sectorIndex
- blockOfSector
- value
- E-Wallet dataDeviceException
- for the standard reasons that are documented in
DeviceException
.MoneyValue readValue(int sectorIndex, int blockOfSector) throws DeviceException
sectorIndex
- blockOfSector
- DeviceException
- for the standard reasons that are documented in
DeviceException
.boolean increaseValue(int sectorIndex, int blockOfSector, int value) throws DeviceException
sectorIndex
- blockOfSector
- value
- increased datatrue
Increases success,false
Increases fail.DeviceException
- for the standard reasons that are documented in
DeviceException
.boolean decreaseValue(int sectorIndex, int blockOfSector, int value) throws DeviceException
sectorIndex
- blockOfSector
- value
- decreased datatrue
Decreases success.false
Decreases fail.DeviceException
- for the standard reasons that are documented in
DeviceException
.byte[] transmit(byte[] apdu, int operation) throws DeviceException
apdu
- data buffer to be transmitted.operation
- reserved for future, must be set to zero.DeviceException
- for the standard reasons that are documented in
DeviceException
and also:
ON