NXP Reader Library  v17.1.0.2535
Commands_FileManagement

These Components implement the MIFARE Identity File Management related commands. More...

Collaboration diagram for Commands_FileManagement:

Functions

phStatus_t phalMfIdentity_CreateTransactionMacFile (void *pDataParams, uint8_t bFileNo, uint8_t bCommMode, uint8_t *pAccessRights, uint8_t bKeyType, uint8_t *bTMKey, uint16_t wKeyNo, uint8_t bTMKeyVer, uint8_t *pDivInput, uint8_t bDivInputLen)
 Creates a Transaction MAC file. More...
 
phStatus_t phalMfIdentity_DeleteFile (void *pDataParams, uint8_t bFileNo)
 Permanently deactivates a file within the file directory of the currently selected application. More...
 
phStatus_t phalMfIdentity_GetFileSettings (void *pDataParams, uint8_t bFileNo, uint8_t *pFSBuffer, uint8_t *bBufferLen)
 Get informtion on the properties of a specific file. More...
 
phStatus_t phalMfIdentity_GetFileCounters (void *pDataParams, uint8_t bOption, uint8_t bFileNo, uint8_t *pFileCounters, uint8_t *pRxLen)
 Returns manufacturing related data of the PICC. More...
 
phStatus_t phalMfIdentity_ChangeFileSettings (void *pDataParams, uint8_t bCommMode, uint8_t bFileNo, uint8_t bFileOption, uint8_t *pAccessRights, uint8_t bAdditionalInfoLen, uint8_t *bAdditionalInfo)
 Changes the access parameters of an existing file. More...
 
phStatus_t phalMfIdentity_ChangeFileSettingsSDM (void *pDataParams, uint8_t bOption, uint8_t bFileNo, uint8_t bFileOption, uint8_t *pAccessRights, uint8_t bSdmOptions, uint8_t *pSdmAccessRights, uint8_t *pPICCDataOffset, uint8_t *pSDMMACInputOffset, uint8_t *pSDMENCOffset, uint8_t *pSDMENCLen, uint8_t *pSDMMACOffset, uint8_t *pSDMReadCtrOffset, uint8_t *pTMCLimitValue)
 Changes the access parameters of an existing file. More...
 

Diversification options to be used with CreateTransactionMacFile command.

These macros are valid only if the layer is initialized for SAM.

#define PHAL_MFIDENTITY_CRTMACFILE_DIVERSIFICATION_OFF   0x00U
 No diversification.
 
#define PHAL_MFIDENTITY_CRTMACFILE_DIVERSIFICATION_ON   0x01U
 Diversification is enabled.
 

The File option and other flags for ChangeFileSettings command.

#define PHAL_MFIDENTITY_FILE_OPTION_PLAIN   0x00U
 Plain mode of communication.
 
#define PHAL_MFIDENTITY_FILE_OPTION_PLAIN_1   0x02U
 Plain mode of communication.
 
#define PHAL_MFIDENTITY_FILE_OPTION_MACD   0x01U
 MAC mode of communication.
 
#define PHAL_MFIDENTITY_FILE_OPTION_ENC   0x03U
 Enciphered mode of communication.
 
#define PHAL_MFIDENTITY_EXCLUNAUTHCONFIG   0x10U
 4th Bit of FileOption indicating Excude Unauthentication config.
 
#define PHAL_MFIDENTITY_TMCLIMITCONFIG   0x20U
 5th Bit of FileOption indicating TMC limit config.
 
#define PHAL_MFIDENTITY_FILE_OPTION_SDM_ENABLED   0x40U
 6th Bit of FileOption indicating Secure Dynamin Messaging and Mirroring.
 
#define PHAL_MFIDENTITY_VCUID_PRESENT   0x80U
 Only VCUID is considred for SDM MAC calculation.
 
#define PHAL_MFIDENTITY_RDCTR_PRESENT   0x40U
 Only RDCTR is considred for SDM MAC calculation.
 
#define PHAL_MFIDENTITY_RDCTR_LIMIT_PRESENT   0x20U
 Indicated the presence of SDM Read Counter Limit.
 
#define PHAL_MFIDENTITY_SDM_ENC_FILE_DATA_PRESENT   0x10U
 Indicated the presence of SDM ENC File data.
 
#define PHAL_MFIDENTITY_MFID_SPECIFICS_ENABLED   0x01U
 MFID Specific feature to be used.
 

Detailed Description

These Components implement the MIFARE Identity File Management related commands.

Function Documentation

◆ phalMfIdentity_CreateTransactionMacFile()

phStatus_t phalMfIdentity_CreateTransactionMacFile ( void *  pDataParams,
uint8_t  bFileNo,
uint8_t  bCommMode,
uint8_t pAccessRights,
uint8_t  bKeyType,
uint8_t bTMKey,
uint16_t  wKeyNo,
uint8_t  bTMKeyVer,
uint8_t pDivInput,
uint8_t  bDivInputLen 
)

Creates a Transaction MAC file.

An application can have only one Transaction MAC File.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bFileNo[In] File number of the file to be created.
[in]bCommMode[In] Communication settings for the file.
[in]pAccessRights[In] The access right to be applied for the file. Should be 2 byte.
[in]bKeyType[In] Bit0-1 indicates key type and it should be always PHAL_MFIDENTITY_KEY_TYPE_AES128
[in]bTMKey[In] The 16 byte key value to be used as TMKey.
[in]wKeyNo[In] The reference key number in SAM keystore. Only valid if initialized for SAM.
[in]bTMKeyVer[In] The version of the TMKey.
[in]pDivInput[In] Diversification input to diversify the TMKey.
[in]bDivInputLen[In] Length of bytes available in DivInput buffer.

◆ phalMfIdentity_DeleteFile()

phStatus_t phalMfIdentity_DeleteFile ( void *  pDataParams,
uint8_t  bFileNo 
)

Permanently deactivates a file within the file directory of the currently selected application.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bFileNo[In] File number of the file to be deleted.

◆ phalMfIdentity_GetFileSettings()

phStatus_t phalMfIdentity_GetFileSettings ( void *  pDataParams,
uint8_t  bFileNo,
uint8_t pFSBuffer,
uint8_t bBufferLen 
)

Get informtion on the properties of a specific file.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bFileNo[In] The file number for which the setting to be retrieved.
[out]pFSBuffer[Out] The buffer containing the settings. The buffer should be 17 bytes.
[out]bBufferLen[Out] The length of bytes available in FSBuffer buffer.

◆ phalMfIdentity_GetFileCounters()

phStatus_t phalMfIdentity_GetFileCounters ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bFileNo,
uint8_t pFileCounters,
uint8_t pRxLen 
)

Returns manufacturing related data of the PICC.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Indicates the mode of communication to be used while exchanging the data to PICC.
[in]bFileNo[In] File number for which the Counter information need to be received.
[out]pFileCounters[Out] The SDMReadCounter information returned by the PICC.
[out]pRxLen[Out] Length of bytes available in FileCounters buffer.

◆ phalMfIdentity_ChangeFileSettings()

phStatus_t phalMfIdentity_ChangeFileSettings ( void *  pDataParams,
uint8_t  bCommMode,
uint8_t  bFileNo,
uint8_t  bFileOption,
uint8_t pAccessRights,
uint8_t  bAdditionalInfoLen,
uint8_t bAdditionalInfo 
)

Changes the access parameters of an existing file.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bCommMode[In] Indicates the mode of communication to be used while exchanging the data to PICC.
[in]bFileNo[In] File number for which the setting need to be updated.
[in]bFileOption[In] New communication settings for the file.
[in]pAccessRights[In] The new access right to be applied for the file. Should be 2 byte.
[in]bAdditionalInfoLen[In] Length of the Additional Info to be sent (2 Bytes or 4 Bytes). This is used to set TMC Limit in case of TMAC File
[in]bAdditionalInfo[In] One of the below inforamtion.
If Standard AES: 4 byte TMC Limit value.
If LRP : 2 byte TMC Limit value.

◆ phalMfIdentity_ChangeFileSettingsSDM()

phStatus_t phalMfIdentity_ChangeFileSettingsSDM ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bFileNo,
uint8_t  bFileOption,
uint8_t pAccessRights,
uint8_t  bSdmOptions,
uint8_t pSdmAccessRights,
uint8_t pPICCDataOffset,
uint8_t pSDMMACInputOffset,
uint8_t pSDMENCOffset,
uint8_t pSDMENCLen,
uint8_t pSDMMACOffset,
uint8_t pSDMReadCtrOffset,
uint8_t pTMCLimitValue 
)

Changes the access parameters of an existing file.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Indicates the mode of communication to be used while exchanging the data to PICC.
[in]bFileNo[In] File number for which the setting need to be updated.
[in]bFileOption[In] New communication settings for the file.
[in]pAccessRights[In] The new access right to be applied for the file. Should be 2 byte.
[in]bSdmOptions[In] One of the below values to be used. Can be ORed.
[in]pSdmAccessRights[In] The SDM access rights to be applied. Should be 2 bytes.
[in]pPICCDataOffset[In] Mirror position (LSB first) for encrypted PICCData. Should be 3 bytes.
[in]pSDMMACInputOffset[In] Offset in the file where the SDM MAC computation starts (LSB first). Should be 3 bytes.
[in]pSDMENCOffset[In] SDMENCFileData mirror position (LSB first). Should be 3 bytes.
[in]pSDMENCLen[In] Length of the SDMENCFileData (LSB first). Should be 3 bytes.
[in]pSDMMACOffset[In] SDMMAC mirror position (LSB first). Should be 3 bytes.
[in]pSDMReadCtrOffset[In] SDMReadCtrLimit value (LSB first). Should be 3 bytes.
[in]pTMCLimitValue[In] TMC Limit to mbe updated. Should be one of the below values.
If EV2 Authenticated, then 4 bytes else
If LRP Authenticated, then 2 bytes