diff --git a/client/src/mifare/desfirecore.c b/client/src/mifare/desfirecore.c index a0611120d..a48f130d2 100644 --- a/client/src/mifare/desfirecore.c +++ b/client/src/mifare/desfirecore.c @@ -1013,6 +1013,22 @@ int DesfireSetConfigurationCmd(DesfireContext *dctx, uint8_t *data, size_t len, return DesfireCommand(dctx, MFDES_CHANGE_CONFIGURATION, data, len, resp, resplen, -1); } +int DesfireGetFileIDList(DesfireContext *dctx, uint8_t *resp, size_t *resplen) { + return DesfireCommandRxData(dctx, MFDES_GET_FILE_IDS, resp, resplen, -1); +} + +int DesfireGetFileISOIDList(DesfireContext *dctx, uint8_t *resp, size_t *resplen) { + return DesfireCommandRxData(dctx, MFDES_GET_ISOFILE_IDS, resp, resplen, -1); +} + +int DesfireCreateFile(DesfireContext *dctx, uint8_t *fdata, size_t fdatalen) { + return DesfireCommandTxData(dctx, MFDES_CREATE_STD_DATA_FILE, fdata, fdatalen); +} + +int DesfireDeleteFile(DesfireContext *dctx, uint8_t fid) { + return DesfireCommandTxData(dctx, MFDES_DELETE_FILE, &fid, 1); +} + uint8_t DesfireKeyAlgoToType(DesfireCryptoAlgorythm keyType) { switch (keyType) { case T_DES: diff --git a/client/src/mifare/desfirecore.h b/client/src/mifare/desfirecore.h index d96ffc54f..43b76dbd7 100644 --- a/client/src/mifare/desfirecore.h +++ b/client/src/mifare/desfirecore.h @@ -61,4 +61,9 @@ int DesfireChangeKey(DesfireContext *dctx, bool change_master_key, uint8_t newke int DesfireSetConfigurationCmd(DesfireContext *dctx, uint8_t *data, size_t len, uint8_t *resp, size_t *resplen); int DesfireSetConfiguration(DesfireContext *dctx, uint8_t paramid, uint8_t *param, size_t paramlen); +int DesfireGetFileIDList(DesfireContext *dctx, uint8_t *resp, size_t *resplen); +int DesfireGetFileISOIDList(DesfireContext *dctx, uint8_t *resp, size_t *resplen); +int DesfireCreateFile(DesfireContext *dctx, uint8_t *fdata, size_t fdatalen); +int DesfireDeleteFile(DesfireContext *dctx, uint8_t fid); + #endif // __DESFIRECORE_H diff --git a/client/src/mifare/desfiresecurechan.c b/client/src/mifare/desfiresecurechan.c index fdf292fca..3b9c1006e 100644 --- a/client/src/mifare/desfiresecurechan.c +++ b/client/src/mifare/desfiresecurechan.c @@ -47,6 +47,8 @@ AllowedChannelModesS AllowedChannelModes[] = { {MFDES_ROLL_KEY_SETTINGS, DACd40, DCCNative, DCMMACed}, {MFDES_COMMIT_READER_ID, DACd40, DCCNative, DCMMACed}, {MFDES_FORMAT_PICC, DACd40, DCCNative, DCMMACed}, + {MFDES_GET_FILE_IDS, DACd40, DCCNative, DCMMACed}, + {MFDES_GET_ISOFILE_IDS, DACd40, DCCNative, DCMMACed}, {MFDES_GET_UID, DACd40, DCCNative, DCMEncrypted}, {MFDES_CHANGE_KEY_SETTINGS, DACd40, DCCNative, DCMEncrypted}, @@ -65,6 +67,8 @@ AllowedChannelModesS AllowedChannelModes[] = { {MFDES_GET_DF_NAMES, DACEV1, DCCNative, DCMMACed}, {MFDES_GET_KEY_SETTINGS, DACEV1, DCCNative, DCMMACed}, {MFDES_FORMAT_PICC, DACEV1, DCCNative, DCMMACed}, + {MFDES_GET_FILE_IDS, DACEV1, DCCNative, DCMMACed}, + {MFDES_GET_ISOFILE_IDS, DACEV1, DCCNative, DCMMACed}, {MFDES_GET_UID, DACEV1, DCCNative, DCMEncrypted}, {MFDES_CHANGE_KEY_SETTINGS, DACEV1, DCCNative, DCMEncrypted},