logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

mad_new, mad_read, mad_write, mad_get_version, mad_set_version, mad_get_card_publisher_sector,

Authors

       Romain Tartiere <romain@blogreen.org>
       Romuald Conty <romuald@libnfc.org>

Debian                                           March 30, 2010                                           MAD(3)

Description

       Mifare Application Directories (MAD) can be easily manipulated using the mad_*() set of functions.

       A  mad can be loaded form a Mifare Classic tag using mad_read() or generated from scratch using mad_new()
       and providing the version of the mad to generate. After using a mad, the memory can  be  reclaimed  using
       mad_free().

       A  mad  can  be  written  to a Mifare Classic tag using mad_write() and providing the B keys required for
       writing to sectors 0, key_b_sector_00, and the one required for writing to sectors  10,  key_b_sector_10.
       When writing a MAD version 1 mad, the key_b_sector_10.

       The version of a MAD mad can be read using mad_get_version() and changed using mad_set_version().

       The  card  publisher  sector number cps can be read read using mad_get_card_publisher_sector() and writen
       using mad_set_card_publisher_sector().

       Sectors allocation in the mad is  handled  by  the  mad_get_aid()  and  mad_set_aid()  functions.   These
       functions fill-in or read the Application Identifier, aid for the given sector.

Library

       Mifare card manipulation library (libfreefare, -lfreefare)

Name

       mad_new,    mad_read,   mad_write,   mad_get_version,   mad_set_version,   mad_get_card_publisher_sector,
       mad_set_card_publisher_sector, mad_get_aid, mad_set_aid, mad_free, — Mifare Application  Directory  (MAD)
       Manipulation Functions

Return Values

       The  mad_new() function return NULL on failure and allocates memory that has to be freed using mad_free()
       on success.  Unless stated otherwise, all other functions return a value greater than or equal  to  0  on
       success or -1 on failure.

See Also

freefare(3), mifare_application(3), mifare_classic(3)

Synopsis

#include<freefare.h>Madmad_new(uint8_tversion);

       Madmad_read(MifareTagtag);

       intmad_write(MifareTagtag, Madmad, MifareClassicKeykey_b_sector_00, MifareClassicKeykey_b_sector_10);

       intmad_get_version(Madmad);

       voidmad_set_version(Madmad, uint8_tversion);

       MifareClassicSectorNumbermad_get_card_publisher_sector(Madmad);

       intmad_set_card_publisher_sector(Madmad, MifareClassicSectorNumbercps);

       intmad_get_aid(Madmad, MifareClassicSectorNumbersector, MadAid*aid);

       intmad_set_aid(Madmad, MifareClassicSectorNumbersector, MadAidaid);

       voidmad_free(Madmad);

See Also