GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MIFARE_CLASSIC_WRITE (3)

NAME

mifare_classic_connect, mifare_classic_disconnect, mifare_classic_authenticate, mifare_classic_read, mifare_classic_init_value, mifare_classic_read_value, mifare_classic_write, mifare_classic_increment, mifare_classic_decrement, mifare_classic_restore, mifare_classic_transfer, mifare_classic_get_trailer_block_permission, mifare_classic_get_data_block_permission, mifare_classic_format_sector, mifare_classic_trailer_block, mifare_classic_block_sector, mifare_classic_sector_first_block, mifare_classic_sector_block_count, mifare_classic_sector_last_block - Mifare Classic Manipulation Functions

CONTENTS

Library
Synopsis
Description
Return Values
See Also
Authors

LIBRARY

Mifare card manipulation library (libfreefare, -lfreefare)

SYNOPSIS


.In freefare.h int mifare_classic_connect MifareTag tag int mifare_classic_disconnect MifareTag tag int mifare_classic_authenticate MifareTag tag const MifareClassicBlockNumber block const MifareClassicKey key const MifareClassicKeyType key_type int mifare_classic_read MifareTag tag const MifareClassicBlockNumber block MifareClassicBlock *data int mifare_classic_init_value MifareTag tag const MifareClassicBlockNumber block const int32_t value const MifareClassicBlockNumber adr int mifare_classic_read_value MifareTag tag const MifareClassicBlockNumber block int32_t *value MifareClassicBlockNumber *adr int mifare_classic_write MifareTag tag const MifareClassicBlockNumber block const MifareClassicBlock data int mifare_classic_increment MifareTag tag const MifareClassicBlockNumber block const uint32_t amount int mifare_classic_decrement MifareTag tag const MifareClassicBlockNumber block const uint32_t amount int mifare_classic_restore MifareTag tag const MifareClassicBlockNumber block int mifare_classic_transfer MifareTag tag const MifareClassicBlockNumber block int mifare_classic_get_trailer_block_permission MifareTag tag const MifareClassicBlockNumber block const uint16_t permission const MifareClassicKeyType key_type int mifare_classic_get_data_block_permission MifareTag tag const MifareClassicBlockNumber block const unsigned char permission const MifareClassicKeyType key_type int mifare_classic_format_sector MifareTag tag const MifareClassicSectorNumber sector void mifare_classic_trailer_block MifareClassicBlock *block const MifareClassicKey key_a const uint8_t ab_0 const uint8_t ab_1 const uint8_t ab_2 const uint8_t ab_tb const uint8_t gpb const MifareClassicKey key_b MifareClassicSectorNumber mifare_classic_block_sector MifareClassicBlockNumber block MifareClassicBlockNumber mifare_classic_sector_first_block MifareClassicSectorNumber sector size_t mifare_classic_sector_block_count MifareClassicSectorNumber sector MifareClassicBlockNumber mifare_classic_sector_last_block MifareClassicSectorNumber sector

DESCRIPTION

The mifare_classic_* set of functions allow manipulation of both Mifare Classic 1k and Mifare Classic 4k cards.

A given
.Vt tag is activated using mifare_classic_connect, deactivation is performed with mifare_classic_disconnect.

After a successful connection, an authentication for a
.Vt block using a
.Vt key of type
.Vt key_type (either MFC_KEY_A or MFC_KEY_B) using mifare_classic_authenticate is required for further operation.

Once successfuly authenticated,
.Vt data of a
.Vt block can be read using mifare_classic_read and written using mifare_classic_write.

Value-blocks can be easily accessed using the mifare_classic_read_value and mifare_classic_init_value functions. Additional functions are available for such
.Vt blocks : mifare_classic_increment and mifare_classic_decrement increment or decrement the value of the provided
.Vt block by
.Vt amount and store the result in the target’s internal data register. The value in this register can also be loaded with the value from another
.Vt block using mifare_classic_restore. Writing back the value of the target’s internal data register to a
.Vt block is requested using mifare_classic_transfer.

Permissions for a data
.Vt block can be fetched using mifare_classic_get_data_block_permission. The access
.Vt permission to be checkf for key
.Vt key_type is one of MCAB_R, MCAB_W, MCAB_I or MCAB_D; respectively for read, write, increment and decrement permissions.

mifare_classic_get_trailer_block_permission acts like mifare_classic_get_data_block_permission but the available
.Vt permissions are MCAB_READ_KEYA, MCAB_READ_KEYB, MCAB_READ_ACCESS_BITS, MCAB_WRITE_ACCESS_BITS, MCAB_READ_KEYB and MCAB_WRITE_KEYB.

A whole sector can be reset to factory defaults using mifare_classic_format_sector.

The mifare_classic_trailer_block is a convenience function for building a trailer block
.Vt block given a A key
.Vt key_a ; access bits for the blocks of the sector
.Vt ab_0 ,
.Vt ab_1 and
.Vt ab_2 ; and a B key
.Vt key_b .

The mifare_classic_block_sector, function returns the number of the sector holding block.

The mifare_classic_sector_first_block, mifare_classic_sector_block_count, mifare_classic_sector_last_block or the complement of the mifare_classic_block_sector function and return various block-level information about the provided sector.

RETURN VALUES

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

SEE ALSO

freefare(3), mad(3)

AUTHORS


.An Romain Tartiere Aq romain@blogreen.org
.An Romuald Conty Aq romuald@libnfc.org
Search for    or go to Top of page |  Section 3 |  Main Index


Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.