![]()  | 
     BALTECH Docs | 
    C API for BALTECH SDK
   
    
   
   | 
   
With this command group, you can access MIFARE DESFire cards in low-level mode. More...
#include "../typedefs.h"Go to the source code of this file.
Macros | |
| #define | BRP_Desfire_ErrIso14NoTag BRP_ERR_STATUS(0x1B00, 0x01) | 
| There's no card in the HF field, or the card doesn't respond.  More... | |
| #define | BRP_Desfire_ErrBreak BRP_ERR_STATUS(0x1B00, 0x03) | 
| The command has been aborted because the HF interface has been requested by another task or command.  More... | |
| #define | BRP_Desfire_ErrIso14Hf BRP_ERR_STATUS(0x1B00, 0x04) | 
| The response frame received from the PICC is invalid, e.g.  More... | |
| #define | BRP_Desfire_ErrIso14CardInvalid BRP_ERR_STATUS(0x1B00, 0x05) | 
| The card behaves in an unspecified way or is corrupted.  More... | |
| #define | BRP_Desfire_ErrReaderChipCommunication BRP_ERR_STATUS(0x1B00, 0x06) | 
| Communication with the reader's HF interface has failed.  More... | |
| #define | BRP_Desfire_ErrIso14ApduCmd BRP_ERR_STATUS(0x1B00, 0x07) | 
| ISO 14443-4 error: The command or parameters are invalid.  More... | |
| #define | BRP_Desfire_ErrIso14InvalidResponse BRP_ERR_STATUS(0x1B00, 0x08) | 
| ISO 14443-4 error: The card returned an invalid response, e.g.  More... | |
| #define | BRP_Desfire_ErrPcdAuthentication BRP_ERR_STATUS(0x1B00, 0x09) | 
| Authentication with the PICC has failed, e.g.  More... | |
| #define | BRP_Desfire_ErrIntegrity BRP_ERR_STATUS(0x1B00, 0x0A) | 
| Secure messaging error: The CRC or MAC checksum doesn't match the transmitted data.  More... | |
| #define | BRP_Desfire_ErrPcdKey BRP_ERR_STATUS(0x1B00, 0x0B) | 
| The key in the SAM/crypto memory is invalid or missing.  More... | |
| #define | BRP_Desfire_ErrNoChanges BRP_ERR_STATUS(0x1B00, 0x0C) | 
| Card error as per DESFire specification: No changes done to backup files, CommitTransaction / AbortTransaction not necessary.  More... | |
| #define | BRP_Desfire_ErrPcdParam BRP_ERR_STATUS(0x1B00, 0x0D) | 
| The BRP command contains an invalid parameter.  More... | |
| #define | BRP_Desfire_VcsAndProxCheckError BRP_ERR_STATUS(0x1B00, 0x0F) | 
| The proximity check has timed out.  More... | |
| #define | BRP_Desfire_ErrFirmwareNotSupported BRP_ERR_STATUS(0x1B00, 0x10) | 
| This command or parameter isn't supported by the reader firmware.  More... | |
| #define | BRP_Desfire_ErrSamCommunication BRP_ERR_STATUS(0x1B00, 0x11) | 
| Communication with the SAM has failed.  More... | |
| #define | BRP_Desfire_ErrSamUnlock BRP_ERR_STATUS(0x1B00, 0x12) | 
| Unlocking/authenticating with the SAM has failed.  More... | |
| #define | BRP_Desfire_ErrHardwareNotSupported BRP_ERR_STATUS(0x1B00, 0x13) | 
| This command isn't supported by the reader hardware.  More... | |
| #define | BRP_Desfire_ErrIllegalCmdLegacy BRP_ERR_STATUS(0x1B00, 0x1C) | 
| Card error as per DESFire specification: Command code not supported by card.  More... | |
| #define | BRP_Desfire_ErrLength BRP_ERR_STATUS(0x1B00, 0x20) | 
| Card error as per DESFire specification: Length of command string invalid.  More... | |
| #define | BRP_Desfire_ErrPermissionDenied BRP_ERR_STATUS(0x1B00, 0x21) | 
| Card error as per DESFire specification: Current configuration/state does not allow the requested command.  More... | |
| #define | BRP_Desfire_ErrParameter BRP_ERR_STATUS(0x1B00, 0x22) | 
| Card error as per DESFire specification: Value of the parameter invalid.  More... | |
| #define | BRP_Desfire_ErrAppNotFound BRP_ERR_STATUS(0x1B00, 0x23) | 
| Card error as per DESFire specification: Requested AID not present on PICC.  More... | |
| #define | BRP_Desfire_ErrAppIntegrity BRP_ERR_STATUS(0x1B00, 0x24) | 
| Card error as per DESFire specification: Unrecoverable error in application.  More... | |
| #define | BRP_Desfire_ErrAuthentication BRP_ERR_STATUS(0x1B00, 0x25) | 
| Card error as per DESFire specification: Current authentication status does not allow execution of requested command.  More... | |
| #define | BRP_Desfire_ErrBoundary BRP_ERR_STATUS(0x1B00, 0x27) | 
| Card error as per DESFire specification: Attempted to read/write beyond the limits of the file.  More... | |
| #define | BRP_Desfire_ErrPiccIntegrity BRP_ERR_STATUS(0x1B00, 0x28) | 
| Card error as per DESFire specification: Unrecoverable error within PICC, PICC will be disabled.  More... | |
| #define | BRP_Desfire_ErrCommandAborted BRP_ERR_STATUS(0x1B00, 0x29) | 
| Card error as per DESFire specification: Previous command was not fully completed.  More... | |
| #define | BRP_Desfire_ErrPiccDisabled BRP_ERR_STATUS(0x1B00, 0x2A) | 
| Card error as per DESFire specification: PICC was disabled by an unrecoverable error.  More... | |
| #define | BRP_Desfire_ErrCount BRP_ERR_STATUS(0x1B00, 0x2B) | 
| Card error as per DESFire specification: Number of applications limited to 28, no additional CreateApplication possible.  More... | |
| #define | BRP_Desfire_ErrDuplicate BRP_ERR_STATUS(0x1B00, 0x2C) | 
| Card error as per DESFire specification: Creation of file/application failed because file/application with same number already exists.  More... | |
| #define | BRP_Desfire_ErrEeprom BRP_ERR_STATUS(0x1B00, 0x2D) | 
| Card error as per DESFire specification: Could not complete NV-write operation due to loss of power, internal backup/rollback mechanism activated.  More... | |
| #define | BRP_Desfire_ErrFileNotFound BRP_ERR_STATUS(0x1B00, 0x2E) | 
| Card error as per DESFire specification: Specified file number does not exist.  More... | |
| #define | BRP_Desfire_ErrFileIntegrity BRP_ERR_STATUS(0x1B00, 0x2F) | 
| Card error as per DESFire specification: Unrecoverable error within file, file will be disabled.  More... | |
| #define | BRP_Desfire_ErrNoSuchKey BRP_ERR_STATUS(0x1B00, 0x30) | 
| Card error as per DESFire specification: Invalid key number specified.  More... | |
| #define | BRP_Desfire_ErrOutOfMemory BRP_ERR_STATUS(0x1B00, 0x32) | 
| Card error as per DESFire specification: Insufficient NV-Memory to complete command .  More... | |
| #define | BRP_Desfire_ErrIllegalCmd BRP_ERR_STATUS(0x1B00, 0x33) | 
| Card error as per DESFire specification: Command code not supported by card.  More... | |
| #define | BRP_Desfire_ErrCmdOverflow BRP_ERR_STATUS(0x1B00, 0x34) | 
| Card error as per DESFire specification: Too many commands in the session or transaction.  More... | |
Functions | |
| brp_errcode | brp_Desfire_ExecCommand (brp_protocol protocol, unsigned Cmd, brp_buf Header, size_t Header_len, brp_buf Param, size_t Param_len, brp_Desfire_ExecCommand_CryptoMode CryptoMode, unsigned ResponseLen, brp_buf *Resp, size_t *Resp_len, brp_mempool *mempool) | 
| Generic command to communicate to a DESFire card.  More... | |
| brp_errcode | brp_Desfire_Authenticate (brp_protocol protocol, brp_Desfire_Authenticate_SecureMessaging SecureMessaging, unsigned DesKeynr, unsigned KeyId, bool KeyHasDivData, brp_Desfire_Authenticate_KeyDivMode KeyDivMode, bool KeyHasExtIdx, brp_buf KeyDivData, size_t KeyDivData_len, unsigned KeyExtIdx) | 
| This command authenticates a card with the reader.  More... | |
| brp_errcode | brp_Desfire_AuthExtKey (brp_protocol protocol, brp_Desfire_AuthExtKey_SecureMessaging SecureMessaging, unsigned DesKeyNr, brp_Desfire_AuthExtKey_CryptoMode CryptoMode, brp_buf Key, size_t Key_len) | 
| This command authenticates a card with the reader, similarly to the brp_Desfire_Authenticate() command, but uses an external authentication key provided as a parameter.  More... | |
| brp_errcode | brp_Desfire_SelectApplication (brp_protocol protocol, unsigned AppId) | 
| Selects an application of the DESFire card.  More... | |
| brp_errcode | brp_Desfire_ReadData (brp_protocol protocol, unsigned FileId, unsigned Adr, unsigned Len, brp_Desfire_ReadData_Mode Mode, brp_buf *Data, size_t *Data_len, brp_mempool *mempool) | 
| Reads data from a Standard or Backup data file.  More... | |
| brp_errcode | brp_Desfire_WriteData (brp_protocol protocol, unsigned FileId, unsigned Adr, brp_buf Data, size_t Data_len, brp_Desfire_WriteData_Mode Mode) | 
| Writes data to a Standard or a Backup data file.  More... | |
| brp_errcode | brp_Desfire_ChangeExtKey (brp_protocol protocol, brp_Desfire_ChangeExtKey_MasterKeyType MasterKeyType, bool IsKeySet, bool IsAesKey, bool IsVersion, bool IsChangeKey, unsigned KeyNo, unsigned KeyVersion, brp_buf NewKey, size_t NewKey_len, brp_buf OldKey, size_t OldKey_len, unsigned KeySet) | 
| This command allows to change any key stored on the card.  More... | |
| brp_errcode | brp_Desfire_ChangeKey (brp_protocol protocol, bool IsKeySet, bool IsMasterKey, bool IsChangeKey, unsigned KeyNr, brp_Desfire_ChangeKey_NewKeyDivMode NewKeyDivMode, bool NewKeyHasDivData, bool NewKeyHasExtIdx, unsigned NewKeyIdx, brp_Desfire_ChangeKey_CurKeyDivMode CurKeyDivMode, bool CurKeyHasDivData, bool CurKeyHasExtIdx, unsigned CurKeyIdx, brp_buf NewKeyDivData, size_t NewKeyDivData_len, brp_buf CurKeyDivData, size_t CurKeyDivData_len, unsigned NewKeyExtIdx, unsigned CurKeyExtIdx, unsigned KeySet) | 
| Modifies a DESFire card key defined in the SAM or crypto memory.  More... | |
| brp_errcode | brp_Desfire_SetFraming (brp_protocol protocol, brp_Desfire_SetFraming_CommMode CommMode) | 
| This command switches the DESFire communication protocol mode to use (std, iso_wrapping).  More... | |
| brp_errcode | brp_Desfire_ResetAuthentication (brp_protocol protocol) | 
| This command resets the reader's authentication state until the next call of the brp_Desfire_Authenticate() or brp_Desfire_AuthExtKey() commands.  More... | |
| brp_errcode | brp_Desfire_CreateDam (brp_protocol protocol, unsigned AppId, brp_buf AppParams, size_t AppParams_len, brp_buf EncryptedDefaultDamKey, size_t EncryptedDefaultDamKey_len, brp_buf DamMacKey, size_t DamMacKey_len) | 
| This command creates a delegated application.  More... | |
| brp_errcode | brp_Desfire_GetOriginalitySignature (brp_protocol protocol, brp_buf *Signature, size_t *Signature_len, brp_mempool *mempool) | 
| This command returns the NXP originality signature of a desfire card.  More... | |
| brp_errcode | brp_Desfire_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) | 
| This command selects a virtual card.  More... | |
| brp_errcode | brp_Desfire_ProxCheck (brp_protocol protocol, unsigned M, bool UseExtProxKey, bool DiversifyProxKey, bool UseProxKey, unsigned ProxKeyIdx, brp_buf DivData, size_t DivData_len, brp_buf ProxKey, size_t ProxKey_len) | 
| This command executes a proximity check of the card.  More... | |
| brp_errcode | brp_Desfire_GetDfNames (brp_protocol protocol, brp_Desfire_GetDfNames_AppNr_Entry **AppNr, size_t *AppNr_len, brp_mempool *mempool) | 
| This command returns the application identifiers together with file IDs and (optionally) DF names of all applications with ISO7816-4 support.  More... | |
With this command group, you can access MIFARE DESFire cards in low-level mode.
You can use these commands to completely manage the card's cryptographic functionality and to simplify the handling of DESFire cards.
Definition in file desfire.h.