-17-
v7.0
Libelium’s library
8.5. Authenticating a sector
This function authenticates a sector of the card thanks to the key or password. It is important to remark that before doing any
read or write in a block, it is mandatory to authenticate us in it.
The only exception is the UID, which can be read without authentication; it is returned by the
init()
function.
One authentication is enough to validate all the 4 blocks in a sector.
Example of use:
{
uint8_t state; // stores the status of the executed command
uint8_t ATQ[2]; // stores the ATQ-A
uint8_t UID[4]; // stores the UID (unique identification) of a card
uint8_t key[6]; // stores the key or password
...
memset(key, 0xFF, 6); // the key by default, edit if needed
state = RFID13.init(UID, ATQ); // inits systems and look for cards
state = RFID13.authenticate(UID, 2, key); // authenticates block number 2 (all sector 0
// actually)of the selected card. State of the executed
//
function
is
stored.
}
http://www.libelium.com/development/waspmote/examples/RFID1356-01-basic-example
8.6. Reading a block
This function reads the 16 bytes stored in a block. This block must have been authenticated before reading.
Example of use:
{
uint8_t state; // stores the status of the executed command
uint8_t aux[16]; // auxiliar buffer
uint8_t UID[4]; // stores the UID (unique identification) of a card
uint8_t key[6]; // stores the key or password
...
memset(key, 0xFF, 6); // the key by default, edit if needed
state = RFID13.init(UID, aux); // inits systems and look for cards
state = RFID13.authenticate(UID, 2, key); // authenticates block 2
state = RFID13.read(2, aux);// reads the block 2. Data is stored in aux.
}
http://www.libelium.com/development/waspmote/examples/RFID1356-02-read-all-blocks