NXP Reader Library  v17.1.0.2535
Commands_SecureMessaging

These Components implement the MIFARE DESFire EVx Secure Messaging related commands. More...

Collaboration diagram for Commands_SecureMessaging:

Functions

phStatus_t phalMfdfEVx_Authenticate (void *pDataParams, uint16_t wOption, uint16_t wKeyNo, uint16_t wKeyVer, uint8_t bKeyNoCard, uint8_t *pDivInput, uint8_t bDivLen)
 Performs an Authentication with the specified key number. More...
 
phStatus_t phalMfdfEVx_AuthenticateISO (void *pDataParams, uint16_t wOption, uint16_t wKeyNo, uint16_t wKeyVer, uint8_t bKeyNoCard, uint8_t *pDivInput, uint8_t bDivLen)
 Performs an DES Authentication in ISO CBS send mode. More...
 
phStatus_t phalMfdfEVx_AuthenticateAES (void *pDataParams, uint16_t wOption, uint16_t wKeyNo, uint16_t wKeyVer, uint8_t bKeyNoCard, uint8_t *pDivInput, uint8_t bDivLen)
 Performs an AES Authentication. More...
 
phStatus_t phalMfdfEVx_AuthenticateEv2 (void *pDataParams, uint8_t bFirstAuth, uint16_t wOption, uint16_t wKeyNo, uint16_t wKeyVer, uint8_t bKeyNoCard, uint8_t *pDivInput, uint8_t bDivLen, uint8_t bLenPcdCapsIn, uint8_t *bPcdCapsIn, uint8_t *bPcdCapsOut, uint8_t *bPdCapsOut)
 Performs an Ev2 First or Non First Authentication depending upon bFirstAuth Parameter. More...
 

Diversification options to be used with Authenticate command.

#define PHAL_MFDFEVX_NO_DIVERSIFICATION   0xFFFFU
 No diversification.
 
#define PHAL_MFDFEVX_DIV_METHOD_ENCR   PH_CRYPTOSYM_DIV_MODE_DESFIRE
 Encryption based method of diversification.
 
#define PHAL_MFDFEVX_DIV_METHOD_CMAC   PH_CRYPTOSYM_DIV_MODE_MIFARE_PLUS
 CMAC based method of diversification.
 
#define PHAL_MFDFEVX_DIV_OPTION_2K3DES_FULL   PH_CRYPTOSYM_DIV_OPTION_2K3DES_FULL
 Encryption based method, full key diversification.
 
#define PHAL_MFDFEVX_DIV_OPTION_2K3DES_HALF   PH_CRYPTOSYM_DIV_OPTION_2K3DES_HALF
 Encryption based method, half key diversification.
 

Detailed Description

These Components implement the MIFARE DESFire EVx Secure Messaging related commands.

Function Documentation

◆ phalMfdfEVx_Authenticate()

phStatus_t phalMfdfEVx_Authenticate ( void *  pDataParams,
uint16_t  wOption,
uint16_t  wKeyNo,
uint16_t  wKeyVer,
uint8_t  bKeyNoCard,
uint8_t pDivInput,
uint8_t  bDivLen 
)

Performs an Authentication with the specified key number.

This command supports the backward compatible D40 authentication. The command can be used with DES and 2K3DES keys and performs DESFire4 native authentication.

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]wOption[In] One of the below options.
[in]wKeyNo[In] Key number in KeyStore of software or SAM.
[in]wKeyVer[In] Key version in the key store of software or SAM.
[in]bKeyNoCard[In] Key number on card. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[in]pDivInput[In] Diversification input. Can be NULL.
[in]bDivLen[In] Length of diversification input max 31B.

◆ phalMfdfEVx_AuthenticateISO()

phStatus_t phalMfdfEVx_AuthenticateISO ( void *  pDataParams,
uint16_t  wOption,
uint16_t  wKeyNo,
uint16_t  wKeyVer,
uint8_t  bKeyNoCard,
uint8_t pDivInput,
uint8_t  bDivLen 
)

Performs an DES Authentication in ISO CBS send mode.

The command can be used with DES,3DES and 3K3DES keys.

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]wOption[In] One of the below options.
[in]wKeyNo[In] Key number in KeyStore of software or SAM.
[in]wKeyVer[In] Key version in the key store of software or SAM.
[in]bKeyNoCard[In] Key number on card. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[in]pDivInput[In] Diversification input. Can be NULL.
[in]bDivLen[In] Length of diversification input max 31B.

◆ phalMfdfEVx_AuthenticateAES()

phStatus_t phalMfdfEVx_AuthenticateAES ( void *  pDataParams,
uint16_t  wOption,
uint16_t  wKeyNo,
uint16_t  wKeyVer,
uint8_t  bKeyNoCard,
uint8_t pDivInput,
uint8_t  bDivLen 
)

Performs an AES Authentication.

The command should be used with AES128 keys.

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]wOption[In] One of the below options.
[in]wKeyNo[In] Key number in KeyStore of software or SAM.
[in]wKeyVer[In] Key version in the key store of software or SAM.
[in]bKeyNoCard[In] Key number on card. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[in]pDivInput[In] Diversification input. Can be NULL.
[in]bDivLen[In] Length of diversification input max 31B.

◆ phalMfdfEVx_AuthenticateEv2()

phStatus_t phalMfdfEVx_AuthenticateEv2 ( void *  pDataParams,
uint8_t  bFirstAuth,
uint16_t  wOption,
uint16_t  wKeyNo,
uint16_t  wKeyVer,
uint8_t  bKeyNoCard,
uint8_t pDivInput,
uint8_t  bDivLen,
uint8_t  bLenPcdCapsIn,
uint8_t bPcdCapsIn,
uint8_t bPcdCapsOut,
uint8_t bPdCapsOut 
)

Performs an Ev2 First or Non First Authentication depending upon bFirstAuth Parameter.

This will be using the AES128 keys and will generate and verify the contents based on generic AES algorithm.

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] One of the below options.
[in]wOption[In] One of the below options.
[in]wKeyNo[In] Key number in KeyStore of software or SAM.
[in]wKeyVer[In] Key version in the key store of software or SAM.
[in]bKeyNoCard[In] Key number on card. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[in]pDivInput[In] Diversification input. Can be NULL.
[in]bDivLen[In] Length of diversification input max 31B.
[in]bLenPcdCapsIn[In] Length of PcdCapsIn. Always zero for NonFirst authentication.
[in]bPcdCapsIn[In] PCD Capabilities. Upto 6 bytes.
[out]bPcdCapsOut[Out] PCD Capabilities. 6 bytes.
[out]bPdCapsOut[Out] PD Capabilities. 6 bytes.