PN7462AU MIFAREClassic 4K Change KEY

Forum / MIFARE and NFC Reader IC`s / PN7462AU MIFAREClassic 4K Change KEY

  • 18. January 2018 at 22:13
    Hi,

    I need a help with changing Key A and Key B on PN7462 board. The default key is uint8_t Key[6] = {0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU}. I am using the example project NfcrdlibEx4_MIFAREClassic.

    I think that function:
    status = phKeyStore_SetKey(psKeyStore, 1, 0, PH_KEYSTORE_KEY_TYPE_MIFARE, Key1[0], 0);
    is used for store Key for authentication.

    I tried to set Key2[6] = {0xAB, 0x01, 0x05, 0xAA, 0xBB, 0xFC} and then call the same function again.
    status = phKeyStore_SetKey(psKeyStore, 1, 1, PH_KEYSTORE_KEY_TYPE_MIFARE, &Key2[0], 1);

    .....................................................................................
    status = phKeyStore_FormatKeyEntry(psKeyStore, 1, PH_KEYSTORE_KEY_TYPE_MIFARE);
    CHECK_STATUS(status);

    DEBUG_PRINTF("\npsKeyStore: %02X\n", psKeyStore);

    phApp_Print_Buff(&sKeyEntries[0], NUMBER_OF_KEYENTRIES);

    /* Set Key Store */
    status = phKeyStore_SetKey(psKeyStore, 1, 0, PH_KEYSTORE_KEY_TYPE_MIFARE, &Key[0], 0);
    CHECK_STATUS(status);
    status = phKeyStore_SetKey(psKeyStore, 1, 1, PH_KEYSTORE_KEY_TYPE_MIFARE, &Key2[0], 1);
    CHECK_STATUS(status);

    .......................................................................................
    Every time I get this message on Debug console:
    Error - (0xE221) has occurred : 0xCCEE CC-Component ID, EE-Error code. Refer-ph_Status.h

    Then the default key (0xFF) is set. Can you please give me advice how do I change the Key. Also, I have a question have to access a different sectors trailer and their blocks. How to change access bits ?.

    Thanks for you answer.

    Best regards,
    Darko.


    + 0  |  - 0

    Re: PN7462AU MIFAREClassic 4K Change KEY

    21. January 2018 at 16:26
    Hi,

    Can anybody help me ?

    Best regards,
    Darko
    + 0  |  - 0

    Re: PN7462AU MIFAREClassic 4K Change KEY

    22. January 2018 at 16:41
    Hi Darko,

    None of us can say anything to the embedded software. If you need support for it, you should contact the TIC forum:

    TIC Forum

    But allow me some general words about changing a key in MIFARE Classic. The default keys for key A and B are FFFFFFFFFFFF. The default access permission allows reading and writing any block in the sector the after authentication with key A. To change the key, you should read the sector trailer (block 3). Please notice, the key value for key A is always FF…FF (you cannot read out the value). But you get the access condition bytes. If you do not want to change it, you only overwrite the key values and write the entire block back to the card. After writing you should re-authenticate with the new key value.

    Regards,
    The TapLinx team
    + 0  |  - 0
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.