annotation of the hitag2 protocol now properly identifies different parts without shifting of whole hex arrays. Took the idea from RFIdler (@adamLLaurie) where he treats it like a binary string instead. It works. Problem: We use whole bytes in our logging protocol and Hitag2 uses 5, 10, 32, 64 bits commands. START_AUTH is 11000, which as a MSB aligned byte is 0xC0. Now we shift it down to LSB centered and 11000 becomes 0x18. This reduces all issues with handing the rest of the array. \n\nTake note that our protocol uses whole bytes. I had to print out number of actually captured bits in the trace log now. Otherwise 65 or 71 bits would not look any different but will not work when used with other tools. This also means we abuse the logging protocol by using the parity byte arry to store number of "left over bits" in the par[0] position.

This commit is contained in:
iceman1001 2024-03-26 15:04:39 +01:00
commit c66e781a9c
4 changed files with 155 additions and 62 deletions

View file

@ -908,12 +908,11 @@ ISO 7816-4 Basic interindustry commands. For command APDU's.
#define HITAG1_HALT 0x70 // left 4 bits only, followed by 8 bits (dummy) page and 8 bits CRC
// HITAG2 commands
#define HITAG2_START_AUTH 0x3 // left 5 bits only
#define HITAG2_HALT 0x0 // left 5 bits only
#define HITAG2_READ_PAGE 0x3 // page number in bits 5 to 3, page number inverted in bit 0 and following 2 bits
#define HITAG2_READ_PAGE_INVERTED 0x1 // page number in bits 5 to 3, page number inverted in bit 0 and following 2 bits
#define HITAG2_WRITE_PAGE 0x2 // page number in bits 5 to 3, page number
#define HITAG2_START_AUTH "11000" // get UID and/or start the authentication process
#define HITAG2_READ_PAGE "11" // read page after auth
#define HITAG2_READ_PAGE_INVERTED "01" // as read page but all bits inverted
#define HITAG2_WRITE_PAGE "10" // write page after auth
#define HITAG2_HALT "00" // silence currently authenticated tag
// HITAG S commands