NXP Reader Library  v17.1.0.2535
Commands_KeyManagement

These Components implement the MIFARE DESFire EVx Key Management related commands. More...

Collaboration diagram for Commands_KeyManagement:

Functions

phStatus_t phalMfdfEVx_ChangeKey (void *pDataParams, uint16_t wOption, uint16_t wOldKeyNo, uint16_t wOldKeyVer, uint16_t wNewKeyNo, uint16_t wNewKeyVer, uint8_t bKeyNoCard, uint8_t *pDivInput, uint8_t bDivLen)
 Changes any key on the PICC. More...
 
phStatus_t phalMfdfEVx_ChangeKeyEv2 (void *pDataParams, uint16_t wOption, uint16_t wOldKeyNo, uint16_t wOldKeyVer, uint16_t wNewKeyNo, uint16_t wNewKeyVer, uint8_t bKeySetNo, uint8_t bKeyNoCard, uint8_t *pDivInput, uint8_t bDivLen)
 Changes any key present in KeySet on the PICC. More...
 
phStatus_t phalMfdfEVx_InitializeKeySet (void *pDataParams, uint8_t bKeySetNo, uint8_t bKeyType)
 Initializes KeySet with bKeySetNo specified with type of the KeySet bKeyType. More...
 
phStatus_t phalMfdfEVx_FinalizeKeySet (void *pDataParams, uint8_t bKeySetNo, uint8_t bKeySetVersion)
 Finalizes KeySet targeted by bKeySetNo by setting the key set version to the bKeySetVersion. More...
 
phStatus_t phalMfdfEVx_RollKeySet (void *pDataParams, uint8_t bKeySetNo)
 RollKeySet changes the ActiveKeySet to key set currently targeted with bKeySetNumber. More...
 
phStatus_t phalMfdfEVx_GetKeySettings (void *pDataParams, uint8_t *pKeySettings, uint8_t *bRespLen)
 Gets information on the PICC and application master key settings. More...
 
phStatus_t phalMfdfEVx_ChangeKeySettings (void *pDataParams, uint8_t bKeySettings)
 Changes the master key settings on PICC and application level. More...
 
phStatus_t phalMfdfEVx_GetKeyVersion (void *pDataParams, uint8_t bKeyNo, uint8_t bKeySetNo, uint8_t *pKeyVersion, uint8_t *bRxLen)
 Reads out the current key version of any key stored on the PICC. More...
 

Diversification options to be used with ChangeKey command.

#define PHAL_MFDFEVX_CHGKEY_NO_DIVERSIFICATION   0xFFFFU
 No diversification.
 
#define PHAL_MFDFEVX_CHGKEY_DIV_NEW_KEY   0x0002U
 Bit 1. More...
 
#define PHAL_MFDFEVX_CHGKEY_DIV_OLD_KEY   0x0004U
 Bit 2 indicating old key was diversified.
 
#define PHAL_MFDFEVX_CHGKEY_DIV_NEW_KEY_ONERND   0x0008U
 Bit 3 indicating new key diversification using one round. More...
 
#define PHAL_MFDFEVX_CHGKEY_DIV_OLD_KEY_ONERND   0x0010U
 Bit 4 indicating old key diversification using one round. More...
 
#define PHAL_MFDFEVX_CHGKEY_DIV_METHOD_CMAC   0x0020U
 Bit 5 indicating key diversification method based on CMAC. More...
 

Option to be used for GetKeyVersion command.

#define PHAL_MFDFEVX_KEYSETNO_NOT_PRESENT   0x00U
 Option for KeySetNo not available in the command.
 
#define PHAL_MFDFEVX_KEYSETNO_PRESENT   0x70U
 Option for KeySetNo available in the command.
 
#define PHAL_MFDFEVX_RETRIVE_KEY_VERSION   0x00U
 Option for retrieving the key version form specific Key Set.
 
#define PHAL_MFDFEVX_RETRIVE_KEY_SET_VERSION   0x80U
 Option for retrieving the key set version.
 

Detailed Description

These Components implement the MIFARE DESFire EVx Key Management related commands.

Macro Definition Documentation

◆ PHAL_MFDFEVX_CHGKEY_DIV_NEW_KEY

#define PHAL_MFDFEVX_CHGKEY_DIV_NEW_KEY   0x0002U

Bit 1.

Indicating diversification of new key required.

◆ PHAL_MFDFEVX_CHGKEY_DIV_NEW_KEY_ONERND

#define PHAL_MFDFEVX_CHGKEY_DIV_NEW_KEY_ONERND   0x0008U

Bit 3 indicating new key diversification using one round.

Default is two rounds.

◆ PHAL_MFDFEVX_CHGKEY_DIV_OLD_KEY_ONERND

#define PHAL_MFDFEVX_CHGKEY_DIV_OLD_KEY_ONERND   0x0010U

Bit 4 indicating old key diversification using one round.

Default is two rounds.

◆ PHAL_MFDFEVX_CHGKEY_DIV_METHOD_CMAC

#define PHAL_MFDFEVX_CHGKEY_DIV_METHOD_CMAC   0x0020U

Bit 5 indicating key diversification method based on CMAC.

Default is Encryption method

Function Documentation

◆ phalMfdfEVx_ChangeKey()

phStatus_t phalMfdfEVx_ChangeKey ( void *  pDataParams,
uint16_t  wOption,
uint16_t  wOldKeyNo,
uint16_t  wOldKeyVer,
uint16_t  wNewKeyNo,
uint16_t  wNewKeyVer,
uint8_t  bKeyNoCard,
uint8_t pDivInput,
uint8_t  bDivLen 
)

Changes any key on 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]wOption[In] One of the below options.
[in]wOldKeyNo[In] Old key number in KeyStore of software or SAM.
[in]wOldKeyVer[In] Old key version in KeyStore of software or SAM.
[in]wNewKeyNo[In] New key number in KeyStore of software or SAM.
[in]wNewKeyVer[In] New key version in KeyStore 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_ChangeKeyEv2()

phStatus_t phalMfdfEVx_ChangeKeyEv2 ( void *  pDataParams,
uint16_t  wOption,
uint16_t  wOldKeyNo,
uint16_t  wOldKeyVer,
uint16_t  wNewKeyNo,
uint16_t  wNewKeyVer,
uint8_t  bKeySetNo,
uint8_t  bKeyNoCard,
uint8_t pDivInput,
uint8_t  bDivLen 
)

Changes any key present in KeySet on the PICC.

Remarks
The key on the PICC is changed to the new key. The key type of the application keys cannot be changed. The key type of only the PICC master key can be changed. The keys changeable are PICCDAMAuthKey, PICCDAMMACKey, PICCDAMEncKey, VCConfigurationKey, SelectVCKey, VCProximityKey, VCPollingEncKey, VCPollingMACKey.
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]wOldKeyNo[In] Old key number in KeyStore of software or SAM.
[in]wOldKeyVer[In] Old key version in KeyStore of software or SAM.
[in]wNewKeyNo[In] New key number in KeyStore of software or SAM.
[in]wNewKeyVer[In] New key version in KeyStore of software or SAM.
[in]bKeySetNo[In] Key set number within targeted application.
[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_InitializeKeySet()

phStatus_t phalMfdfEVx_InitializeKeySet ( void *  pDataParams,
uint8_t  bKeySetNo,
uint8_t  bKeyType 
)

Initializes KeySet with bKeySetNo specified with type of the KeySet bKeyType.

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]bKeySetNo[In] Key set number within targeted application. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[in]bKeyType[In] One of the below mentioned options.

◆ phalMfdfEVx_FinalizeKeySet()

phStatus_t phalMfdfEVx_FinalizeKeySet ( void *  pDataParams,
uint8_t  bKeySetNo,
uint8_t  bKeySetVersion 
)

Finalizes KeySet targeted by bKeySetNo by setting the key set version to the bKeySetVersion.

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]bKeySetNo[In] Key set number within targeted application. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.
[in]bKeySetVersion[In] KeySet version of the key set to be finalized.

◆ phalMfdfEVx_RollKeySet()

phStatus_t phalMfdfEVx_RollKeySet ( void *  pDataParams,
uint8_t  bKeySetNo 
)

RollKeySet changes the ActiveKeySet to key set currently targeted with bKeySetNumber.

Remarks
After successful execution of this command the keys of new AKS can be used any active authentication is lost
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]bKeySetNo[In] Key set number within targeted application. ORed with PHAL_MFDFEVX_SAI to indicate secondary application indicator.

◆ phalMfdfEVx_GetKeySettings()

phStatus_t phalMfdfEVx_GetKeySettings ( void *  pDataParams,
uint8_t pKeySettings,
uint8_t bRespLen 
)

Gets information on the PICC and application master key settings.

Remarks
In addition it returns the maximum number of keys which are configured for the 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.
[out]pKeySettings[Out] Returns the key settings. Can be 2 or 3 bytes.
[out]bRespLen[Out] Length bytes available in KeySettings buffer.

◆ phalMfdfEVx_ChangeKeySettings()

phStatus_t phalMfdfEVx_ChangeKeySettings ( void *  pDataParams,
uint8_t  bKeySettings 
)

Changes the master key settings on PICC and application level.

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]bKeySettings[In] New key settings to be updated.

◆ phalMfdfEVx_GetKeyVersion()

phStatus_t phalMfdfEVx_GetKeyVersion ( void *  pDataParams,
uint8_t  bKeyNo,
uint8_t  bKeySetNo,
uint8_t pKeyVersion,
uint8_t bRxLen 
)

Reads out the current key version of any key stored on 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]bKeyNo[In] Key number of the targeted key. ORed with one of the below options
[in]bKeySetNo[In] Key set number. ORed with one of the below options
[out]pKeyVersion[Out] Key set versions of the selected application ordered by ascending key set number, i.e. starting with the AKS.
[out]bRxLen[Out] Length of bytes available in KeyVersion buffer.