libnfc  1.7.1
Functions
mifare.c File Reference

provide samples structs and functions to manipulate MIFARE Classic and Ultralight tags using libnfc More...

#include "mifare.h"
#include <string.h>
#include <nfc/nfc.h>

Go to the source code of this file.

Functions

bool nfc_initiator_mifare_cmd (nfc_device *pnd, const mifare_cmd mc, const uint8_t ui8Block, mifare_param *pmp)
 Execute a MIFARE Classic Command. More...
 

Detailed Description

provide samples structs and functions to manipulate MIFARE Classic and Ultralight tags using libnfc

Definition in file mifare.c.

Function Documentation

◆ nfc_initiator_mifare_cmd()

bool nfc_initiator_mifare_cmd ( nfc_device pnd,
const mifare_cmd  mc,
const uint8_t  ui8Block,
mifare_param *  pmp 
)

Execute a MIFARE Classic Command.

Returns
Returns true if action was successfully performed; otherwise returns false.
Parameters
pmpSome commands need additional information. This information should be supplied in the mifare_param union.

The specified MIFARE command will be executed on the tag. There are different commands possible, they all require the destination block number.

Note
There are three different types of information (Authenticate, Data and Value).

First an authentication must take place using Key A or B. It requires a 48 bit Key (6 bytes) and the UID. They are both used to initialize the internal cipher-state of the PN53X chip. After a successful authentication it will be possible to execute other commands (e.g. Read/Write). The MIFARE Classic Specification (http://www.nxp.com/acrobat/other/identification/M001053_MF1ICS50_rev5_3.pdf) explains more about this process.

Definition at line 60 of file mifare.c.