add verbosity

This commit is contained in:
merlokk 2021-08-12 17:28:29 +03:00
commit e7c0caabcf
2 changed files with 25 additions and 1 deletions

View file

@ -3886,7 +3886,9 @@ 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 --rawrights 1F30 --mackey 00112233445566778899aabbccddeeff --mackeyver 01 -> create transaction mac file with parameters. Rights from default. Authentication with defaults from `default` command\n"
"Write right should be always 0xF. Read-write right should be 0xF if you not need to submit CommitReaderID command each time transaction starts\n"
"\n"
"hf mfdes createmacfile --aid 123456 --fid 01 --rawrights 0FF0 --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 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");

View file

@ -2424,6 +2424,28 @@ void DesfirePrintCreateFileSettings(uint8_t filetype, uint8_t *data, size_t len)
PrintAndLogEx(SUCCESS, "Access rights : %04x", MemLeToUint2byte(&data[xlen]));
DesfirePrintAccessRight(&data[xlen]);
xlen += 2;
// https://www.nxp.com/docs/en/data-sheet/MF2DLHX0.pdf
// page 14
// TransactionMAC file
if (filetype == 0x05) {
uint8_t read = 0;
uint8_t write = 0;
uint8_t readwrite = 0;
uint8_t change = 0;
DesfireDecodeFileAcessMode(&data[xlen - 2], &read, &write, &readwrite, &change);
if (write != 0x0f)
PrintAndLogEx(WARNING, "descr. : Write right should be set to F because write " _RED_("not allowed") ".");
if (readwrite == 0x0f)
PrintAndLogEx(SUCCESS, "descr. : ReadWrite right is %01X, CommitReaderID command disabled", readwrite);
else if (readwrite == 0x0e)
PrintAndLogEx(SUCCESS, "descr. : ReadWrite right is %01X, CommitReaderID command enabled with free access", readwrite);
else if (readwrite <= 0x04)
PrintAndLogEx(SUCCESS, "descr. : ReadWrite right is %01X, CommitReaderID command enabled with key 0x0%01x", readwrite, readwrite);
else
PrintAndLogEx(WARNING, "descr. : ReadWrite right must me 0..4,E,F instead of is %01X.", readwrite);
}
uint8_t reclen = 0;
DesfirePrintFileSettDynPart(filetype, &data[xlen], len - xlen, &reclen, true);