Problem on reading DESFire tag with 3KDES encryption

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem on reading DESFire tag with 3KDES encryption

351 Views
david13
Contributor III

Dear Support team,

We are developing CLRC663 application with using NFC Library v05.22.00.

We have a problem with reading Mifare DESFire EV1 tag.

We issue DESFire tag with 3K3DS encryption, and we use following API to

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

When the program run on FRAME Command and go to the step- [Get the encrypted RndA' into bWorkBuffer], it will occur the error: [MF DF Current authentication status does not allow the requested cmd].

If wee use DES encryption tag, then it will be OK.

We want to know the reason why cause this error. Or there is needed parameters initialization we miss?

Following code is for 3KDES:
case KEY_TYPE_3KDES:
{
Is_Gigatms_Mdf_Setkey(g_tRegisters.s2.DF.bKey ,PH_KEYSTORE_KEY_TYPE_3K3DES ,STORE_KEYNUM_3K3DES);
status = phalMfdf_AuthenticateISO(psalMFDF, PHAL_MFDF_NO_DIVERSIFICATION, STORE_KEYNUM_3K3DES, 0, 0, NULL, 0);
break;
} }


Following code is for DES:
case KEY_TYPE_DES:
{
Is_Gigatms_Mdf_Setkey(g_tRegisters.s2.DF.bKey ,PH_KEYSTORE_KEY_TYPE_DES ,STORE_KEYNUM_DES);
status = phalMfdf_AuthenticateISO(psalMFDF, PHAL_MFDF_NO_DIVERSIFICATION, STORE_KEYNUM_DES, 0, 0, NULL, 0);
break;
}

Following code is to set key:
bool Is_Gigatms_Mdf_Setkey(uint8_t *pKey, uint8_t bKeyType, uint8_t bKeyName)
{
status = phKeyStore_FormatKeyEntry(psKeyStore, bKeyName, bKeyType);

if ((status & PH_ERR_MASK) != PH_ERR_SUCCESS)
return FALSE;
/* Set Key Store */
status = phKeyStore_SetKey(psKeyStore, bKeyName, 0, bKeyType, pKey, 0);
if ((status & PH_ERR_MASK) != PH_ERR_SUCCESS)
return FALSE;
return TRUE;
}

0 Kudos
0 Replies