NXP Reader Library  v17.1.0.2535
Commands_Authenticate

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

Collaboration diagram for Commands_Authenticate:

Functions

phStatus_t phalMfp_AuthenticateClassicSL2 (void *pDataParams, uint8_t bBlockNo, uint8_t bKeyType, uint16_t wKeyNumber, uint16_t wKeyVersion, uint8_t *pUid, uint8_t bUidLength)
 Perform MIFARE(R) Authenticate command in Security Level 2 with MIFARE Picc. More...
 
phStatus_t phalMfp_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 complete MIFARE Plus Authentication for Security Level 0. More...
 
phStatus_t phalMfp_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 complete MIFARE Plus Authentication for Security Level 1. More...
 
phStatus_t phalMfp_AuthenticateSL2 (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, uint8_t *pKmf)
 Performs a complete MIFARE Plus Authentication and Key Derivation for Security Level 2. More...
 
phStatus_t phalMfp_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 complete MIFARE Plus Authentication and Key Derivation for Security Level 3. More...
 

Options to indicate the Authentication type to be performed.

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

Detailed Description

These Components implement the MIFARE Plus authentication commands.

Function Documentation

◆ phalMfp_AuthenticateClassicSL2()

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

Perform MIFARE(R) Authenticate command in Security Level 2 with MIFARE 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]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.

◆ phalMfp_AuthenticateSL0()

phStatus_t phalMfp_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 complete MIFARE Plus Authentication for Security Level 0.

The high-level function performs a 2-step (in future applications also 3-step) authentication.
See the section Evolution on the Main Page regarding future changes in the key parameter.

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  |   0   |   1   |
* +-------------+---+---+---+---+
* | bLayer4Comm | 0 | 1 | 0 | 1 |
* +-------------+---+---+---+---+
* | wBlockNr    | X | X | X | X |
* | pKx         | X | X | X | X |
* | pRndA       | X | X | X | X |
* | bLenPcdCap2 | - | - | - | X |
* | pPcdCap2    | - | - | - | X |
* | pPdCap2     | - | - | - | X |
* +-------------+---+---+---+---+
* 
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]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.

◆ phalMfp_AuthenticateSL1()

phStatus_t phalMfp_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 complete MIFARE Plus Authentication for Security Level 1.

The high-level function performs a 2-step (in future applications also 3-step) authentication.
See the section Evolution on the Main Page regarding future changes in the key parameter.

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  |   0   |   1   |
* +-------------+---+---+---+---+
* | bLayer4Comm | 0 | 1 | 0 | 1 |
* +-------------+---+---+---+---+
* | wBlockNr    | X | X | X | X |
* | pKx         | X | X | X | X |
* | pRndA       | X | X | X | X |
* | bLenPcdCap2 | - | - | - | X |
* | pPcdCap2    | - | - | - | X |
* | pPdCap2     | - | - | - | X |
* +-------------+---+---+---+---+
* 
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]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.

◆ phalMfp_AuthenticateSL2()

phStatus_t phalMfp_AuthenticateSL2 ( 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,
uint8_t pKmf 
)

Performs a complete MIFARE Plus Authentication and Key Derivation for Security Level 2.

The high-level function performs a 2-step (in future applications also 3-step) authentication.
The function provides the resulting MIFARE Sector Key Modifier.
If a MIFARE Classic authentication is performed afterwards, use the MIFARE Sector Key Modifier XOR the MIFARE Classic sector key as the key.
See the section Evolution on the Main Page regarding future changes in the key parameter.

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  |   0   |   1   |
* +-------------+---+---+---+---+
* | bLayer4Comm | 0 | 1 | 0 | 1 |
* +-------------+---+---+---+---+
* | wBlockNr    | X | X | X | X |
* | pKx         | X | X | X | X |
* | pRndA       | X | X | X | X |
* | bLenPcdCap2 | - | - | - | X |
* | pPcdCap2    | - | - | - | X |
* | pPdCap2     | - | - | - | X |
* | pKmf        | X | - | - | - |
* +-------------+---+---+---+---+
* 
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]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.
[out]pKmf[Out] MIFARE Sector Key Modifier (6 bytes).

◆ phalMfp_AuthenticateSL3()

phStatus_t phalMfp_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 complete MIFARE Plus Authentication and Key Derivation for Security Level 3.

The high-level function performs a 2-step (in future applications also 3-step) authentication.
The function computes the resulting session keys for encryption and MACing and stores them in the card state structure.
See the section Evolution on the Main Page regarding future changes in the key parameter.

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  |   0   |   1   |
* +-------------+---+---+---+---+
* | wBlockNr    | X | X | X | X |
* | pKx         | X | X | X | X |
* | pRndA       | X | X | X | X |
* | bLenPcdCap2 | - | - | - | X |
* | pPcdCap2    | - | - | - | X |
* | pPdCap2     | - | - | - | X |
* +-------------+---+---+---+---+
* 
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]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.