NXP Reader Library  v17.1.0.2535
Commands_Authenticate

These Components implement the MIFARE Plus EVx authentication commands. More...

Collaboration diagram for Commands_Authenticate:

Functions

phStatus_t phalMfpEVx_AuthenticateMfc (void *pDataParams, uint8_t bBlockNo, uint8_t bKeyType, uint16_t wKeyNumber, uint16_t wKeyVersion, uint8_t *pUid, uint8_t bUidLength)
 Perform MIFARE Authenticate command in Security Level 1 with MIFARE CLASSIC PICC. More...
 
phStatus_t phalMfpEVx_AuthenticateSL0 (void *pDataParams, uint8_t bLayer4Comm, uint8_t bFirstAuth, uint16_t wBlockNr, uint16_t wKeyNumber, uint16_t wKeyVersion, uint8_t bLenDivInput, uint8_t *pDivInput, uint8_t bLenPcdCap2, uint8_t *pPcdCap2In, uint8_t *pPcdCap2Out, uint8_t *pPdCap2)
 Performs a MIFARE Plus Authentication for Security Level 0.This command performs basic Authenticate First / Non-First command execution and also performs the AuthenticateContinue command internally. More...
 
phStatus_t phalMfpEVx_AuthenticateSL1 (void *pDataParams, uint8_t bLayer4Comm, uint8_t bFirstAuth, uint16_t wBlockNr, uint16_t wKeyNumber, uint16_t wKeyVersion, uint8_t bLenDivInput, uint8_t *pDivInput, uint8_t bLenPcdCap2, uint8_t *pPcdCap2In, uint8_t *pPcdCap2Out, uint8_t *pPdCap2)
 Performs a MIFARE Plus Authentication for Security Level 1. More...
 
phStatus_t phalMfpEVx_AuthenticateSL3 (void *pDataParams, uint8_t bFirstAuth, uint16_t wBlockNr, uint16_t wKeyNumber, uint16_t wKeyVersion, uint8_t bLenDivInput, uint8_t *pDivInput, uint8_t bLenPcdCap2, uint8_t *pPcdCap2In, uint8_t *pPcdCap2Out, uint8_t *pPdCap2)
 Performs a MIFARE Plus Authentication for Security Level 3. More...
 
phStatus_t phalMfpEVx_SSAuthenticate (void *pDataParams, uint8_t bOption, uint16_t wSSKeyBNr, uint16_t wSSKeyNr, uint16_t wSSKeyVer, uint8_t bLenDivInputSSKey, uint8_t *pDivInputSSKey, uint8_t bSecCount, uint16_t *pSectorNos, uint16_t *pKeyNos, uint16_t *pKeyVers, uint8_t bLenDivInputSectorKeyBs, uint8_t *pDivInputSectorKeyBs)
 Perform MIFARE(R) Sector switch authentication command. More...
 
phStatus_t phalMfpEVx_AuthenticatePDC (void *pDataParams, uint16_t wBlockNr, uint16_t wKeyNumber, uint16_t wKeyVersion, uint8_t bLenDivInput, uint8_t *pDivInput, uint8_t bUpgradeInfo)
 Perform MIFARE(R) Sector switch authentication command. More...
 

Key type options for MIFARE Classic contactless IC Authentication.

#define PHAL_MFPEVX_KEYA   0x0AU
 MIFARE(R) Key A.
 
#define PHAL_MFPEVX_KEYB   0x0BU
 MIFARE(R) Key B.
 

Options to indicate the Authentication type to be performed.

#define PHAL_MFPEVX_AUTHENTICATE_FIRST   0x01U
 Option to indicate the authenticate type as first.
 
#define PHAL_MFPEVX_AUTHENTICATE_NON_FIRST   0x00U
 Option to indicate the authenticate type as non-first or following.
 

Options to indicate the type of diversification to be performed for Sector Switch Authenticate command.

All these macros are applicable for Sam X and S mode only.

For Software mode, these macros has no meaning even though they are passed.

#define PHAL_MFPEVX_SS_AUTHENTICATE_NO_DIVERSIFICATION   0x00U
 Option to indicate that the diversificationis disabled.
 
#define PHAL_MFPEVX_SS_AUTHENTICATE_SECTOR_SWITCH_DIVERSIFICATION   0x01U
 Option to indicate that the diversification is enabled for Sector Switch keys (9006 or 9007).
 
#define PHAL_MFPEVX_SS_AUTHENTICATE_SECTOR_DIVERSIFICATION   0x02U
 Option to indicate that the diversification is enabled for AES Sector keys (4001, 4003, etc...).
 
#define PHAL_MFPEVX_SS_AUTHENTICATE_MASTER_SECTOR_DIVERSIFICATION   0x04U
 Option to indicate that the diversification is enabled for AES Sector keys (4001, 4003, etc...). More...
 

Detailed Description

These Components implement the MIFARE Plus EVx authentication commands.

Macro Definition Documentation

◆ PHAL_MFPEVX_SS_AUTHENTICATE_MASTER_SECTOR_DIVERSIFICATION

#define PHAL_MFPEVX_SS_AUTHENTICATE_MASTER_SECTOR_DIVERSIFICATION   0x04U

Option to indicate that the diversification is enabled for AES Sector keys (4001, 4003, etc...).

using a Master key.

Function Documentation

◆ phalMfpEVx_AuthenticateMfc()

phStatus_t phalMfpEVx_AuthenticateMfc ( void *  pDataParams,
uint8_t  bBlockNo,
uint8_t  bKeyType,
uint16_t  wKeyNumber,
uint16_t  wKeyVersion,
uint8_t pUid,
uint8_t  bUidLength 
)

Perform MIFARE Authenticate command in Security Level 1 with MIFARE CLASSIC PICC.

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]bBlockNo[In] PICC block number to be used for authentication.
[in]bKeyType[In] Authentication key type to be used.
[in]wKeyNumber[In] Key number to used from software or hardware KeyStore.
[in]wKeyVersion[In] Key version to used from software or hardware KeyStore.
[in]pUid[In] UID of the PICC received during anti-collision sequence.
[in]bUidLength[In] Length of the UID buffer.

◆ phalMfpEVx_AuthenticateSL0()

phStatus_t phalMfpEVx_AuthenticateSL0 ( void *  pDataParams,
uint8_t  bLayer4Comm,
uint8_t  bFirstAuth,
uint16_t  wBlockNr,
uint16_t  wKeyNumber,
uint16_t  wKeyVersion,
uint8_t  bLenDivInput,
uint8_t pDivInput,
uint8_t  bLenPcdCap2,
uint8_t pPcdCap2In,
uint8_t pPcdCap2Out,
uint8_t pPdCap2 
)

Performs a MIFARE Plus Authentication for Security Level 0.This command performs basic Authenticate First / Non-First command execution and also performs the AuthenticateContinue command internally.

The following table shows which parameter is relevant depending on the parameters bLayer4Comm and bFirstAuth.
An "X" encodes that this parameter is relevant. A "-" encodes that this parameter is ignored (if it is an in-parameter) or that it shall be ignored (if it is an out-parameter).

* +-------------+-------------+-------------+-------------+-------------+
* | bFirstAuth  |    AUTHENTICATE_NON_FIRST |     AUTHENTICATE_FIRST    |
* +-------------+-------------+-------------+-------------+-------------+
* | bLayer4Comm | ISO14443_L3 | ISO14443_L4 | ISO14443_L3 | ISO14443_L4 |
* +-------------+-------------+-------------+-------------+-------------+
* | wBlockNr    |       X     |       X     |       X     |       X     |
* | wKeyNumber  |       X     |       X     |       X     |       X     |
* | wKeyVersion |       X     |       X     |       X     |       X     |
* | bLenPcdCap2 |       -     |       -     |       -     |       X     |
* | pPcdCap2In  |       -     |       -     |       -     |       X     |
* | pPcdCap2    |       -     |       -     |       -     |       X     |
* | pPdCap2     |       -     |       -     |       -     |       X     |
* +-------------+-------------+-------------+-------------+-------------+
* 
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]bLayer4Comm[In] ISO14443 protocol to be used.
[in]bFirstAuth[In] Type of authentication to be performed.
[in]wBlockNr[In] PICC Block number to be used for authentication.
[in]wKeyNumber[In] Key number be to used from software or hardware KeyStore.
[in]wKeyVersion[In] Key version be to used from software or hardware KeyStore.
[in]bLenDivInput[In] Length of diversification input used to diversify the key. If 0, no diversification is performed.
[in]pDivInput[In] Diversification Input used to diversify the key.
[in]bLenPcdCap2[In] Length of the input PCD capabilities.
[in]pPcdCap2In[In] Buffer containing the Input PCD Capabilities.
If length is non zero, PCDCapabilites should be available.
If length is zero, PCDCapabilites buffer should be NULL.
[out]pPcdCap2Out[Out] Buffer containing the Output PCD capabilities. This will be of 6 bytes.
[out]pPdCap2[Out] Buffer containing the Output PD capabilities. This will be of 6 bytes.

◆ phalMfpEVx_AuthenticateSL1()

phStatus_t phalMfpEVx_AuthenticateSL1 ( void *  pDataParams,
uint8_t  bLayer4Comm,
uint8_t  bFirstAuth,
uint16_t  wBlockNr,
uint16_t  wKeyNumber,
uint16_t  wKeyVersion,
uint8_t  bLenDivInput,
uint8_t pDivInput,
uint8_t  bLenPcdCap2,
uint8_t pPcdCap2In,
uint8_t pPcdCap2Out,
uint8_t pPdCap2 
)

Performs a MIFARE Plus Authentication for Security Level 1.

This command performs basic Authenticate First / Non-First command execution and also performs the AuthenticateContinue command internally.

The following table shows which parameter is relevant depending on the parameters bLayer4Comm and bFirstAuth.
An "X" encodes that this parameter is relevant. A "-" encodes that this parameter is ignored (if it is an in-parameter) or that it shall be ignored (if it is an out-parameter).

* +-------------+-------------+-------------+-------------+-------------+
* | bFirstAuth  |    AUTHENTICATE_NON_FIRST |     AUTHENTICATE_FIRST    |
* +-------------+-------------+-------------+-------------+-------------+
* | bLayer4Comm | ISO14443_L3 | ISO14443_L4 | ISO14443_L3 | ISO14443_L4 |
* +-------------+-------------+-------------+-------------+-------------+
* | wBlockNr    |       X     |       X     |       X     |       X     |
* | wKeyNumber  |       X     |       X     |       X     |       X     |
* | wKeyVersion |       X     |       X     |       X     |       X     |
* | bLenPcdCap2 |       -     |       -     |       -     |       X     |
* | pPcdCap2In  |       -     |       -     |       -     |       X     |
* | pPcdCap2    |       -     |       -     |       -     |       X     |
* | pPdCap2     |       -     |       -     |       -     |       X     |
* +-------------+-------------+-------------+-------------+-------------+
* 
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]bLayer4Comm[In] ISO14443 protocol to be used.
[in]bFirstAuth[In] Type of authentication to be performed.
[in]wBlockNr[In] PICC Block number to be used for authentication.
[in]wKeyNumber[In] Key number to be used from software or hardware KeyStore.
[in]wKeyVersion[In] Key version to be used from software or hardware KeyStore.
[in]bLenDivInput[In] Length of diversification input used to diversify the key. If 0, no diversification is performed.
[in]pDivInput[In] Diversification Input used to diversify the key.
[in]bLenPcdCap2[In] Length of the input PCD capabilities.
[in]pPcdCap2In[In] Buffer containing the Input PCD Capabilities.
If length is non zero, PCDCapabilites should be available.
If length is zero, PCDCapabilites buffer should be NULL.
[out]pPcdCap2Out[Out] Buffer containing the Output PCD capabilities. This will be of 6 bytes.
[out]pPdCap2[Out] Buffer containing the Output PD capabilities. This will be of 6 bytes.

◆ phalMfpEVx_AuthenticateSL3()

phStatus_t phalMfpEVx_AuthenticateSL3 ( void *  pDataParams,
uint8_t  bFirstAuth,
uint16_t  wBlockNr,
uint16_t  wKeyNumber,
uint16_t  wKeyVersion,
uint8_t  bLenDivInput,
uint8_t pDivInput,
uint8_t  bLenPcdCap2,
uint8_t pPcdCap2In,
uint8_t pPcdCap2Out,
uint8_t pPdCap2 
)

Performs a MIFARE Plus Authentication for Security Level 3.

This command performs basic Authenticate First / Non-First command execution and also performs the AuthenticateContinue command internally.

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]bFirstAuth[In] Type of authentication to be performed.
[in]wBlockNr[In] PICC Block number to be used for authentication.
[in]wKeyNumber[In] Key number to be used from software or hardware KeyStore.
[in]wKeyVersion[In] Key version to be used from software or hardware KeyStore.
[in]bLenDivInput[In] Length of diversification input used to diversify the key. If 0, no diversification is performed.
[in]pDivInput[In] Diversification Input used to diversify the key.
[in]bLenPcdCap2[In] Length of the input PCD capabilities.
[in]pPcdCap2In[In] Buffer containing the Input PCD Capabilities.
If length is non zero, PCDCapabilites should be available.
If length is zero, PCDCapabilites buffer should be NULL.
[out]pPcdCap2Out[Out] Buffer containing the Output PCD capabilities. This will be of 6 bytes.
[out]pPdCap2[Out] Buffer containing the Output PD capabilities. This will be of 6 bytes.

◆ phalMfpEVx_SSAuthenticate()

phStatus_t phalMfpEVx_SSAuthenticate ( void *  pDataParams,
uint8_t  bOption,
uint16_t  wSSKeyBNr,
uint16_t  wSSKeyNr,
uint16_t  wSSKeyVer,
uint8_t  bLenDivInputSSKey,
uint8_t pDivInputSSKey,
uint8_t  bSecCount,
uint16_t pSectorNos,
uint16_t pKeyNos,
uint16_t pKeyVers,
uint8_t  bLenDivInputSectorKeyBs,
uint8_t pDivInputSectorKeyBs 
)

Perform MIFARE(R) Sector switch authentication command.

This command is valid in Security Level 1 only. This command performs basic Authenticate First / Non-First command execution and also performs the AuthenticateContinue command internally.

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] Options for key diversification. Only applicable for SAM component, ignored for Software component.
[in]wSSKeyBNr[In] PICC block number to be used for Sector Switch authentication.
[in]wSSKeyNr[In] Key number to be used from software or hardware KeyStore for sector switch key(SSKey)
[in]wSSKeyVer[In] Key number to be used from software or hardware KeyStore for sector switch key(SSKey)
[in]bLenDivInputSSKey[In] Length of diversification input used to diversify the Sector Switch key.
In Software, if 0, no diversification is performed.
If Sam, ony if PHAL_MFPEVX_SS_AUTHENTICATE_SECTOR_SWITCH_DIVERSIFICATION is set, diversification of Sector Switch key will be performed. In this case, there should be proper length available.
[in]pDivInputSSKey[In] Diversification Input used to diversify the sector switch key.
[in]bSecCount[In] Number of sectors available in SectorNos buffer.
[in]pSectorNos[In] The list of AES sector B key numbers for switching the sectors.
[in]pKeyNos[In] If Option is set to use the Master sector key, then the master sector key number to be used from software or hardware KeyStore should be passed, else individual Sector B key number to be used from software or hardware KeyStore should be passed.
[in]pKeyVers[In] If Option is set to use the Master sector key, then the master sector key version to be used from software or hardware KeyStore should be passed, else individual Sector B key version to be used from software or hardware KeyStore should be passed.
[in]bLenDivInputSectorKeyBs[In] Length of diversification input used to diversify the AES Sector B key.
For SAM if length is 0, the diversification input passed for Sector Switch key will be used.
For SW if length is 0, no diversification is performed.
[in]pDivInputSectorKeyBs[In] Diversification Input used to diversify the AES Sector B key.

◆ phalMfpEVx_AuthenticatePDC()

phStatus_t phalMfpEVx_AuthenticatePDC ( void *  pDataParams,
uint16_t  wBlockNr,
uint16_t  wKeyNumber,
uint16_t  wKeyVersion,
uint8_t  bLenDivInput,
uint8_t pDivInput,
uint8_t  bUpgradeInfo 
)

Perform MIFARE(R) Sector switch authentication command.

This command performs the AuthenticateContinue command internally.

* +-----------------+---------------+
* | CardSize/SubType| bUpgrade Info |
* +-----------------+---------------+
* |      0.5k       |      0xX0     |
* |      1k         |      0xX1     |
* |      2k         |      0xX2     |
* |      4k         |      0xX4     |
* |      8k         |      0xX8     |
* |      RFU        |   Other data  |
* +-----------------+---------------+
* 
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]wBlockNr[In] PICC Block number to be used for authentication.
[in]wKeyNumber[In] Key number to used from software or hardware KeyStore.
[in]wKeyVersion[In] Key version to used from software or hardware KeyStore.
[in]bLenDivInput[In] Length of diversification input used to diversify the key. If 0, no diversification is performed.
[in]pDivInput[In] Diversification Input used to diversify the key.
[in]bUpgradeInfo[In] The upgrade info input.