mifare_application_read(3) Mifare Applications Manipulation Functions

Other Alias

mifare_application_alloc, mifare_application_find, mifare_application_free, mifare_application_write

LIBRARY

Mifare card manipulation library (libfreefare, -lfreefare)

SYNOPSIS

In freefare.h Ft MifareClassicSectorNumber * Fn mifare_application_alloc Mad mad MadAid aid size_t size Ft void Fn mifare_application_free Mad mad MadAid aid Ft MifareClassicSectorNumber * Fn mifare_application_find Mad mad MadAid aid Ft ssize_t Fn mifare_application_read MifareTag tag Mad mad MadAid aid void *buf size_t nbytes MifareClassicKey key MifareClassicKeyType key_type Ft ssize_t Fn mifare_application_write MifareTag tag Mad mad MadAid aid const void *buf size_t nbytes MifareClassicKey key MifareClassicKeyType key_type

DESCRIPTION

The Fn mifare_application_* functions facilitate management of applications in a Mifare Application Directory.

The Fn mifare_application_alloc function allocates enought sectors to store Vt size bytes for the Application Identifier Vt aid and returns the list of allocated sectors.

The list of the sectors previously allocated for Vt aid in a Vt mad can be requested using Fn mifare_application_find .

An application can be removed from a Vt mad using Fn mifare_application_free .

The Fn mifare_application_read reads at most Vt nbytes of the application identified by Vt aid in the Vt mad on the Vt tag and copy them into Vt buf. The function returns the amount of data it copied, or -1 on error.

The Fn mifare_application_write functions writes at most Vt nbytes of Vt buf in the application identified by Vt aid on the Vt mad of the Vt tag and returns the quantity of data written, or -1 on error.

IMPLEMENTATION NOTES

The Fn mifare_application_alloc function will try to avoid wasting space and might not allocate sectors sequentially if a large amount of space is requested and the target has sectors of different size.

The Vt nbytes argument of Fn mifare_application_read and Fn mifare_application_write does not need to be aligned on blocks not sectors.

RETURN VALUES

Unless stated otherwise, all functions return a value greater than or equal to 0 on success or -1 on failure.

AUTHORS

An Romain Tartiere Aq [email protected] An Romuald Conty Aq [email protected]