Search code examples
pythonmifaresmartcard-readerpcsc

How to store key in the smart card reader?


I am using reader ACR1281 and MIFARE cards.

I communicate with the cards using python smartcard library (pc/sc).

I know the MIFARE key to read the card blocks and want to store the key in reader to use it (as I see in the doc this is the only way to use my key - store it in the reader and 'authenticated' with it the block to read).

But specified in the ACR documentation command FF 82 00 00 06 FF FF FF FF FF FF returns error 63 00.

In the command above I use key number 0 (volatile) and key value FF FF FF FF FF FF.


Solution

  • Silly error. I am using volatile key (P1 = key_structure = 0). And by the ACS documentation for that I can use only one key number - session key (P2 = key_number = 0x20).

    So correct command is

    FF 82 00 20 06 FF FF FF FF FF FF
    

    Wrong command I'd got from another ACS reader documentation.