create file works. fixed consts, mode and samples

This commit is contained in:
merlokk 2021-07-27 14:51:31 +03:00
parent 2f1f9f8c6e
commit d22817f8cc
3 changed files with 5 additions and 6 deletions

View file

@ -5984,8 +5984,8 @@ static int CmdHF14ADesCreateTrMACFile(const char *Cmd) {
"Create Transaction MAC file in the application. Application master key needs to be provided or flag --no-auth set (depend on application settings).",
"--rawrights have priority over the separate rights settings.\n"
"Key/mode/etc of the authentication depends on application settings\n"
"hf mfdes createmacfile --aid 123456 --fid 01 --mackey 00112233445566778899aabbccddeeff --mackeyver 01 -> create transaction mac file with parameters. Rights from default. Authentication with defaults from `default` command\n"
"hf mfdes createmacfile --aid 123456 --fid 01 --amode plain --rrights free --wrights free --rwrights free --chrights key0 --mackey 00112233445566778899aabbccddeeff -> create file app=123456, file=01, with key, and mentioned rights with defaults from `default` command\n"
"hf mfdes createmacfile --aid 123456 --fid 01 --mackey --rawrights 1F30 00112233445566778899aabbccddeeff --mackeyver 01 -> create transaction mac file with parameters. Rights from default. Authentication with defaults from `default` command\n"
"hf mfdes createmacfile --aid 123456 --fid 01 --amode plain --rrights free --wrights deny --rwrights free --chrights key0 --mackey 00112233445566778899aabbccddeeff -> create file app=123456, file=01, with key, and mentioned rights with defaults from `default` command\n"
"hf mfdes createmacfile -n 0 -t des -k 0000000000000000 -f none --aid 123456 --fid 01 -> execute with default factory setup. key and keyver == 0x00..00");
void *argtable[] = {
@ -6024,7 +6024,7 @@ static int CmdHF14ADesCreateTrMACFile(const char *Cmd) {
DesfireContext dctx;
int securechann = defaultSecureChannel;
uint32_t appid = 0x000000;
int res = CmdDesGetSessionParameters(ctx, &dctx, 3, 4, 5, 6, 7, 8, 9, 10, 11, &securechann, DCMPlain, &appid);
int res = CmdDesGetSessionParameters(ctx, &dctx, 3, 4, 5, 6, 7, 8, 9, 10, 11, &securechann, DCMEncrypted, &appid);
if (res) {
CLIParserFree(ctx);
return res;

View file

@ -1202,7 +1202,7 @@ static const DesfireCreateFileCommandsS DesfireFileCommands[] = {
{0x02, "Value", MFDES_CREATE_VALUE_FILE, 16, 16, false},
{0x03, "Linear Record", MFDES_CREATE_LINEAR_RECORD_FILE, 12, 9, true},
{0x04, "Cyclic Record", MFDES_CREATE_CYCLIC_RECORD_FILE, 12, 9, true},
{0x05, "Transaction MAC", MFDES_CREATE_TRANS_MAC_FILE, 5, 22, false},
{0x05, "Transaction MAC", MFDES_CREATE_TRANS_MAC_FILE, 5, 21, false},
};
const DesfireCreateFileCommandsS *GetDesfireFileCmdRec(uint8_t type) {
@ -1346,7 +1346,7 @@ static void DesfirePrintFileSettDynPart(uint8_t filetype, uint8_t *data, size_t
break;
}
case 0x05: {
PrintAndLogEx(INFO, "Key type [0x%02x] : %s", data[0], GetDesfireKeyType(data[0]));
PrintAndLogEx(INFO, "Key type [0x%02x] : %s", data[0], GetDesfireKeyType(data[0]));
*dynlen = 1;
if (create) {

View file

@ -66,7 +66,6 @@ AllowedChannelModesS AllowedChannelModes[] = {
{MFDES_CHANGE_FILE_SETTINGS, DACd40, DCCNative, DCMEncrypted},
{MFDES_READ_DATA, DACd40, DCCNative, DCMEncrypted},
{MFDES_WRITE_DATA, DACd40, DCCNative, DCMEncrypted},
{MFDES_CREATE_TRANS_MAC_FILE, DACd40, DCCNative, DCMEncrypted},
{MFDES_CHANGE_KEY, DACd40, DCCNative, DCMEncryptedPlain},
{MFDES_CHANGE_KEY_EV2, DACd40, DCCNative, DCMEncryptedPlain},