BALTECH Docs |
C API for BALTECH SDK
|
#include "../typedefs.h"
Go to the source code of this file.
Functions | |
brp_errcode | brp_Mif_LoadKey (brp_protocol protocol, unsigned KeyIdx, brp_buf Key) |
brp_errcode | brp_Mif_Request (brp_protocol protocol, unsigned ReqAll, unsigned *ATQA) |
brp_errcode | brp_Mif_Anticoll (brp_protocol protocol, unsigned BitCount, brp_buf PreSelSer, brp_buf *Snr, brp_mempool *mempool) |
brp_errcode | brp_Mif_Select (brp_protocol protocol, brp_buf Snr, unsigned *SAK) |
brp_errcode | brp_Mif_AuthE2 (brp_protocol protocol, unsigned AuthMode, unsigned Block, unsigned KeyIdx) |
brp_errcode | brp_Mif_AuthUser (brp_protocol protocol, unsigned AuthMode, unsigned Block, brp_buf Key) |
brp_errcode | brp_Mif_Read (brp_protocol protocol, unsigned Block, brp_buf *BlockData, brp_mempool *mempool) |
brp_errcode | brp_Mif_Write (brp_protocol protocol, unsigned Block, brp_buf BlockData) |
brp_errcode | brp_Mif_ChangeValue (brp_protocol protocol, unsigned Mode, unsigned Block, unsigned Value) |
brp_errcode | brp_Mif_ChangeValueBackup (brp_protocol protocol, unsigned Mode, unsigned Block, unsigned Value) |
brp_errcode | brp_Mif_TransferBlock (brp_protocol protocol, unsigned Block) |
brp_errcode | brp_Mif_Halt (brp_protocol protocol) |
brp_errcode | brp_Mif_AuthE2Extended (brp_protocol protocol, unsigned AuthLevel, bool KeyHasExtIdx, unsigned EV1Mode, bool IsKeyB, unsigned Block, unsigned KeyIdx, unsigned KeyExtIdx, brp_buf DivData, size_t DivData_len) |
brp_errcode | brp_Mif_AuthUserExtended (brp_protocol protocol, unsigned AuthLevel, unsigned EV1Mode, unsigned KeyB, unsigned Block, brp_buf Key, size_t Key_len) |
brp_errcode | brp_Mif_ResetAuth (brp_protocol protocol) |
brp_errcode | brp_Mif_ReadSL3 (brp_protocol protocol, unsigned NoMacOnCmd, unsigned PlainData, unsigned NoMacOnResp, unsigned Block, unsigned BlockNr, brp_buf *BlockData, size_t *BlockData_len, brp_mempool *mempool) |
brp_errcode | brp_Mif_WriteSL3 (brp_protocol protocol, unsigned PlainData, unsigned NoMacOnResp, unsigned Block, brp_buf BlockData, size_t BlockData_len) |
brp_errcode | brp_Mif_ChangeAESKey (brp_protocol protocol, bool KeyHasExtIdx, unsigned NoMacOnResp, unsigned Block, unsigned KeyIdx, unsigned KeyExtIdx, brp_buf DivData, size_t DivData_len) |
brp_errcode | brp_Mif_ValueSL3 (brp_protocol protocol, unsigned NoMacOnResp, unsigned Cmd, unsigned Block, unsigned DestBlock, unsigned Value, brp_buf *TMCounterTMValue, size_t *TMCounterTMValue_len, brp_mempool *mempool) |
brp_errcode | brp_Mif_ProxCheck (brp_protocol protocol, unsigned M, unsigned DisableIsoWrapping, bool UseExtProxKey, bool DiversifyProxKey, bool UseProxKey, unsigned ProxKeyIdx, brp_buf DivData, size_t DivData_len, brp_buf ProxKey, size_t ProxKey_len) |
brp_errcode | brp_Mif_GetCardVersion (brp_protocol protocol, brp_buf *CardVersion, size_t *CardVersion_len, brp_mempool *mempool) |
brp_errcode | brp_Mif_ReadSig (brp_protocol protocol, brp_buf *NxpSignature, size_t *NxpSignature_len, brp_mempool *mempool) |
brp_errcode | brp_Mif_VirtualCardSelect (brp_protocol protocol, bool ForceVcsAuthentication, bool UseExtVcSelectKeys, unsigned DiversifyMacKey, bool DiversifyEncKey, bool UseVcSelectKeys, brp_buf IID, size_t IID_len, unsigned EncKeyIdx, unsigned MacKeyIdx, brp_buf DivData, size_t DivData_len, brp_buf EncKey, size_t EncKey_len, brp_buf MacKey, size_t MacKey_len, unsigned *FciType, brp_buf *Fci, size_t *Fci_len, brp_mempool *mempool) |
brp_errcode | brp_Mif_SectorSwitch (brp_protocol protocol, bool L3SectorSwitch, unsigned SectorSwitchKeyIdx, brp_buf SectorSwitchKeyDivData, size_t SectorSwitchKeyDivData_len, brp_Mif_SectorSwitch_SectorSpec_Entry *SectorSpec, size_t SectorSpec_len, brp_buf SectorKeysDivData, size_t SectorKeysDivData_len) |
brp_errcode | brp_Mif_CommitReaderID (brp_protocol protocol, unsigned Block, brp_buf *EncTRI, size_t *EncTRI_len, brp_mempool *mempool) |
brp_errcode | brp_Mif_SetFraming (brp_protocol protocol, brp_Mif_SetFraming_CommMode CommMode) |
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 Mif.Request command is executed. Cards in requested state participate in the anti-collision sequence, controlled by the 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 Mif.Select command. All other cards will fall back to idle state again and wait for the next call of the Mif.Request command. The selected card, however, changes from requested state to selected state.
TheMif.Anticoll andMif.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 theISO14443-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 Mif.AuthE2 command or with the 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 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 Mif.Read and 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 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.