![]() |
BALTECH Docs |
BALTECH SDK wrapper functions reference
|
With this command group, you can access MIFARE cards in low-level mode. More...
#include "../typedefs.h"Go to the source code of this file.
Data Structures | |
| struct | brp_Mif_LoadKey_t |
| struct | brp_Mif_AuthE2_t |
| struct | brp_Mif_AuthUser_t |
| struct | brp_Mif_Read_t |
| struct | brp_Mif_Write_t |
| struct | brp_Mif_ChangeValue_t |
| struct | brp_Mif_ChangeValueBackup_t |
| struct | brp_Mif_TransferBlock_t |
| struct | brp_Mif_AuthE2Extended_t |
| struct | brp_Mif_AuthUserExtended_t |
| struct | brp_Mif_ResetAuth_t |
| struct | brp_Mif_ReadSL3_t |
| struct | brp_Mif_WriteSL3_t |
| struct | brp_Mif_ChangeAESKey_t |
| struct | brp_Mif_ValueSL3_t |
| struct | brp_Mif_ProxCheck_t |
| struct | brp_Mif_GetCardVersion_t |
| struct | brp_Mif_ReadSig_t |
| struct | brp_Mif_VirtualCardSelect_t |
| struct | brp_Mif_SectorSwitch_t |
| struct | brp_Mif_CommitReaderID_t |
| struct | brp_Mif_SetFraming_t |
Macros | |
| #define | BRP_Mif_ErrNoTag BRP_ERR_STATUS(0x1000, 0x01) |
| There's no card in the HF field, or the card doesn't respond. More... | |
| #define | BRP_Mif_ErrAuth BRP_ERR_STATUS(0x1000, 0x04) |
| Card authentication has failed. More... | |
| #define | BRP_Mif_ErrParity BRP_ERR_STATUS(0x1000, 0x05) |
| Legacy error code: The parity bits don't match the transmitted data. More... | |
| #define | BRP_Mif_ErrCode BRP_ERR_STATUS(0x1000, 0x06) |
| The card behaves in an unspecified way. More... | |
| #define | BRP_Mif_ErrKey BRP_ERR_STATUS(0x1000, 0x09) |
| The key in the SAM/crypto memory is invalid or missing. More... | |
| #define | BRP_Mif_ErrNotauth BRP_ERR_STATUS(0x1000, 0x0A) |
| Card authentication has failed. More... | |
| #define | BRP_Mif_ErrBitcount BRP_ERR_STATUS(0x1000, 0x0B) |
| Legacy error code: HF data transition error. More... | |
| #define | BRP_Mif_ErrBytecount BRP_ERR_STATUS(0x1000, 0x0C) |
| Legacy error code: HF data transition error. More... | |
| #define | BRP_Mif_VcsAndProxCheckError BRP_ERR_STATUS(0x1000, 0x0E) |
| The proximity check has timed out. More... | |
| #define | BRP_Mif_ErrFraming BRP_ERR_STATUS(0x1000, 0x15) |
| The response frame is invalid, e.g. More... | |
| #define | BRP_Mif_ErrCmd BRP_ERR_STATUS(0x1000, 0x17) |
| The specified command or parameters are unknown. More... | |
| #define | BRP_Mif_ErrColl BRP_ERR_STATUS(0x1000, 0x18) |
| An error occurred in the anti-collision sequence. More... | |
| #define | BRP_Mif_CondNotvalid BRP_ERR_STATUS(0x1000, 0x20) |
| Card error as per MIFARE specification: Condition of use not satisfied. More... | |
Functions | |
| brp_errcode | brp_Mif_LoadKey (brp_Mif_LoadKey_t params) |
| This command writes a MIFARE Classic key to the reader's secure key memory. More... | |
| brp_errcode | brp_Mif_AuthE2 (brp_Mif_AuthE2_t params) |
| This command authenticates a certain sector of a card using a key from the secure EEPROM of the Baltech reader chip. More... | |
| brp_errcode | brp_Mif_AuthUser (brp_Mif_AuthUser_t params) |
| This command authenticates a certain sector of a card using the key specified in the Key variable. More... | |
| brp_errcode | brp_Mif_Read (brp_Mif_Read_t params) |
| This command reads data from a specified block of the currently selected card, providing authentication has been performed beforehand. More... | |
| brp_errcode | brp_Mif_Write (brp_Mif_Write_t params) |
| This command write data to a specified block of the currently selected card, providing authentication has been performed beforehand. More... | |
| brp_errcode | brp_Mif_ChangeValue (brp_Mif_ChangeValue_t params) |
| This command uses the value block specified by the Block parameter and performs an operation given by the Mode parameter. More... | |
| brp_errcode | brp_Mif_ChangeValueBackup (brp_Mif_ChangeValueBackup_t params) |
| This command is identical to brp_Mif_ChangeValue(), but can only be used for MIFARE cards which support automatic transfer, such as Pro or Light MIFARE variants. More... | |
| brp_errcode | brp_Mif_TransferBlock (brp_Mif_TransferBlock_t params) |
| This command transfers data from the card's internal Transfer Buffer to a specified block. More... | |
| brp_errcode | brp_Mif_AuthE2Extended (brp_Mif_AuthE2Extended_t params) |
| This command is identical to the brp_Mif_AuthE2() command with the exception that it supports stronger authentication methods (MIFARE and AES), supported by MIFARE Pro cards. More... | |
| brp_errcode | brp_Mif_AuthUserExtended (brp_Mif_AuthUserExtended_t params) |
| This command is identical to the brp_Mif_AuthUser() command with the exception that it supports stronger authentication methods (MIFARE and AES), supported by MIFARE Pro cards. More... | |
| brp_errcode | brp_Mif_ResetAuth (brp_Mif_ResetAuth_t params) |
| This command resets the reader's authentication state (used for MIFARE Pro specific Read/Write counters. More... | |
| brp_errcode | brp_Mif_ReadSL3 (brp_Mif_ReadSL3_t params) |
| This command reads blocks from an SL3-authenticated MIFARE Pro card. More... | |
| brp_errcode | brp_Mif_WriteSL3 (brp_Mif_WriteSL3_t params) |
| This command writes blocks to an SL3-authenticated MIFARE Pro card. More... | |
| brp_errcode | brp_Mif_ChangeAESKey (brp_Mif_ChangeAESKey_t params) |
| This command changes an AES key on a MIFARE Plus card. More... | |
| brp_errcode | brp_Mif_ValueSL3 (brp_Mif_ValueSL3_t params) |
| This command performs an operation on a value block. More... | |
| brp_errcode | brp_Mif_ProxCheck (brp_Mif_ProxCheck_t params) |
| This command performs a proximity check. More... | |
| brp_errcode | brp_Mif_GetCardVersion (brp_Mif_GetCardVersion_t params) |
| This command returns HW- / SW- / Production-Information. More... | |
| brp_errcode | brp_Mif_ReadSig (brp_Mif_ReadSig_t params) |
| brp_errcode | brp_Mif_VirtualCardSelect (brp_Mif_VirtualCardSelect_t params) |
| Command is only supported by MIFARE Plus EV1 cards. More... | |
| brp_errcode | brp_Mif_SectorSwitch (brp_Mif_SectorSwitch_t params) |
| This command performs a sector switch command (only for EV1 cards). More... | |
| brp_errcode | brp_Mif_CommitReaderID (brp_Mif_CommitReaderID_t params) |
| This commands commits a reader ID from a card and returns the encrypted TMRI to the host. More... | |
| brp_errcode | brp_Mif_SetFraming (brp_Mif_SetFraming_t params) |
| This command switches the communication protocol mode for MIFARE Plus EV1 cards. More... | |
With this command group, you can access MIFARE cards in low-level mode.
Whenever a card enters the HF field, it will be in idle state. From the idle state, a card switches to the requested state as soon as the brp_Mif_Request() command is executed. Cards in requested state participate in the anti-collision sequence, controlled by the brp_Mif_Anticoll() command, resulting in an unambiguous serial number belonging to one of the cards in the HF field. The card with this serial number may now be selected with the brp_Mif_Select() command. All other cards will fall back to idle state again and wait for the next call of the brp_Mif_Request() command. The selected card, however, changes from requested state to selected state.
The brp_Mif_Anticoll() and brp_Mif_Select() commands can only process serial numbers with a length of 4 bytes. Since 2010, however, MIFARE cards with a 7-byte serial number are available. Please use theISO 14443-3 (Type A) command group to select and process cards with 7-byte serial numbers.
When a card is in selected state, communication with the card is possible. Nevertheless, it is necessary to be authenticated before a sector of the card can be accessed. Authentication can be performed either with the brp_Mif_AuthE2() command or with the brp_Mif_AuthUser() command. Both commands send a key to the currently selected card along with information regarding whether this key should be compared to key A or key B on the card. If the given key matches the corresponding sector's key (either key A or key B, as specified in the command's parameters), then access according to the access conditions of the desired sector will be granted.
Finally, a card that is in select state can be set to halt state. A card in halt state will not respond to any command unless a specially parameterized brp_Mif_Request() command is called, or when it leaves and then re-enters the HF field of the reader's antenna. The halt state is helpful when it is necessary to deal with multiple cards present in the reader's antenna HF field.
The brp_Mif_Read() and brp_Mif_Write() commands can be use to read/write data from/to a certain block. Additionally, a data sector may be turned into a special value sector (also called value block), which is initialized with a specific starting value and can then only be changed by means of increment and decrement operations using the ChangeValue or ChangeValueBackup commands. Value sectors are very useful in some scenarios, such as for cash-based applications. To create a value sector, it is simply required to write specially formatted data to it:
Each increment and decrement operation has to be followed by a transfer operation, using the brp_Mif_TransferBlock() command, in order to make the increment/decrement persistent. This feature guarantees that no data will be lost during a recalculation of the value on the card.
Definition in file mif.h.