NXP Reader Library  v17.1.0.2535

SAM commands used for MIFARE Classic card communication in Non-X-Mode. More...

Collaboration diagram for MIFARE Classic in Non-X Mode:

Macros

#define PHHAL_HW_SAMAV2_CMD_MF_AUTHENTICATE_MIFARE_DATA_LENGTH_PART1   0x0E
 Length of data of the Auth Mifare command Part1.
 
#define PHHAL_HW_SAMAV2_CMD_MF_AUTHENTICATE_MIFARE_DATA_LENGTH_PART2   0x05
 Length of data of the Auth Mifare command Part2.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_CHANGE_KEY_MIFARE_CHANGING_MIN_DATA_LENGTH   0x07
 Minimum data length of SAM_ChangeKeyMIFARE_Changing command.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_CHANGE_KEY_MIFARE_CHANGING_MAX_DATA_LENGTH   0x0C
 Maximum data length of SAM_ChangeKeyMIFARE_Changing command.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_CHANGE_KEY_MIFARE_RETRIEVE_MIN_DATA_LENGTH   0x03
 Minimum data length of SAM_ChangeKeyMIFARE_Retrieve command.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_CHANGE_KEY_MIFARE_RETRIEVE_MAX_DATA_LENGTH   0x08
 Maximum data length of SAM_ChangeKeyMIFARE_Retrieve command.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_CHANGE_KEY_MIFARE_CHANGING_RESPONSE_LENGTH   0x15
 Response length of the SAM_ChangeKeyMIFARE_Changing command.
 

Functions

phStatus_t phhalHw_SamAV2_Cmd_SAM_AuthenticateMifare_Part1 (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t bOption, uint8_t *pUid, uint8_t bKeyNoM, uint8_t bKeyVM, uint8_t bKeyType, uint8_t bBlockNo, uint8_t *pRndB, uint8_t bDivBlockNo, uint8_t *pTokenAB)
 First part of MF Authenticate. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_AuthenticateMifare_Part2 (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t *pTokenAB)
 Second part of MF Authenticate. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_ChangeKeyMifare (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t bOption, uint8_t bKeyNoM, uint8_t bKeyVM_KeyVMA, uint8_t bKeyAorB_KeyVMB, uint8_t *pAccessConditions, uint8_t *pUid, uint8_t bDivBlockNo, uint8_t *pKeyData, uint8_t *pKeyDataLength)
 Change key MIFARE command used to prepare an encrypted stream to be written to a MIFARE Classic card. More...
 

Sam AV2 command code for Sam MIFARE Classic Non-X feature.

#define PHHAL_HW_SAMAV2_CMD_MF_AUTHENTICATE_MIFARE_INS   0x1C
 CMD Byte for AuthenticateMifare command.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_CHANGE_KEY_MIFARE_INS   0xC5
 CMD Byte for SAM_ChangeKeyMIFARE command.
 

Option macros for Sam AV2 MIFARE Classic Non-X Authenticate command.

#define PHHAL_HW_SAMAV2_CMD_SAM_AUTHENTICATE_MIFARE_DEFAULT   0x00
 Default option mask for SAM_AuthenticateMifare.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_AUTHENTICATE_MIFARE_DIVERSIFY   0x01
 Option mask for authentication with key diversification.
 

Option macros for Sam AV2 MIFARE Classic Non-X ChangeKey command.

#define PHHAL_HW_SAMAV2_CMD_SAM_CHANGEKEY_MIFARE_RETRIEVE_KEY   0x01
 Option flag for key retrieval for transactions in host system.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_CHANGEKEY_MIFARE_DIVERSIFY_KEY_A   0x02
 Option flag for diversification of key A.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_CHANGEKEY_MIFARE_DIVERSIFY_KEY_B   0x04
 Option flag for diversification of key B.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_CHANGEKEY_MIFARE_ENCRYPT   0x08
 Option flag for encrypted key retrival. More...
 

Detailed Description

SAM commands used for MIFARE Classic card communication in Non-X-Mode.

See also
Data Processing

Macro Definition Documentation

◆ PHHAL_HW_SAMAV2_CMD_SAM_CHANGEKEY_MIFARE_ENCRYPT

#define PHHAL_HW_SAMAV2_CMD_SAM_CHANGEKEY_MIFARE_ENCRYPT   0x08

Option flag for encrypted key retrival.

Not used in case of key change for MIFARE 1k or 4k.

Function Documentation

◆ phhalHw_SamAV2_Cmd_SAM_AuthenticateMifare_Part1()

phStatus_t phhalHw_SamAV2_Cmd_SAM_AuthenticateMifare_Part1 ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t  bOption,
uint8_t pUid,
uint8_t  bKeyNoM,
uint8_t  bKeyVM,
uint8_t  bKeyType,
uint8_t  bBlockNo,
uint8_t pRndB,
uint8_t  bDivBlockNo,
uint8_t pTokenAB 
)

First part of MF Authenticate.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Option parameter:
[in]pUid[In] Pointer to the Uid of the Card.
[in]bKeyNoM[In] Key Number.
[in]bKeyVM[In] Key Version.
[in]bKeyType[In] Key type A (0Ah) or B (0Bh).
[in]bBlockNo[In] Block Number.
[in]pRndB[In] Random number received from card (5 bytes).
[in]bDivBlockNo[In] Block number used for diversification.
[out]pTokenAB[Out] Buffer containing the token to be sent to the card. The buffer has to be 9 bytes long.

◆ phhalHw_SamAV2_Cmd_SAM_AuthenticateMifare_Part2()

phStatus_t phhalHw_SamAV2_Cmd_SAM_AuthenticateMifare_Part2 ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t pTokenAB 
)

Second part of MF Authenticate.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pTokenAB[In] Token received from the card (5 bytes).

◆ phhalHw_SamAV2_Cmd_SAM_ChangeKeyMifare()

phStatus_t phhalHw_SamAV2_Cmd_SAM_ChangeKeyMifare ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t  bOption,
uint8_t  bKeyNoM,
uint8_t  bKeyVM_KeyVMA,
uint8_t  bKeyAorB_KeyVMB,
uint8_t pAccessConditions,
uint8_t pUid,
uint8_t  bDivBlockNo,
uint8_t pKeyData,
uint8_t pKeyDataLength 
)

Change key MIFARE command used to prepare an encrypted stream to be written to a MIFARE Classic card.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Option parameter:
[in]bKeyNoM[In] Reference number of MIFARE key (00h to 7Fh).
[in]bKeyVM_KeyVMA[In] Key version of MIFARE key in case of key retrieval or key version of MIFARE key A in case of key change.
[in]bKeyAorB_KeyVMB[In] Key 0Ah or 0Bh in case of key retrieval or key version of MIFARE key B in case of key change..
[in]pAccessConditions[In] Access conditions to be stored within MIFARE card. Only used for key change. This buffer has to be 4 bytes long.
[in]pUid[In] Uid of the card. Only used if diversification is needed. This buffer has to be 4 bytes long.
[in]bDivBlockNo[In] Block number to be used for diversification.
[out]pKeyData[Out] Buffer containing the key data. The buffer has to be 16 bytes long in case of key retrieval and 21 bytes long in case of key change.
[out]pKeyDataLength[Out] Amount of valid data bytes in pKeyData.