Getting Error 1E when trying to ChangeKey

Forum / MIFARE SmartCard IC`s / MIFARE DESFire / Getting Error 1E when trying to ChangeKey


  • 4. April 2018 at 10:32
    I am implementing a software library to support DESFire EV1 card with our reader.
    I am programming based on the MF3ICD81 product data sheet (doc 134036)

    When trying to change the key on application I allways get the error 1E back from the card.

    I have already tried several CRC algorythms but still get the error.

    I have implemented the CRC based on this source code:

    I ported the MifareCrc16 function to and confirmed using the test data referenced in the comment that the correct CRC was generated.

    Below are the steps and data during the change key process:

    DESFire ChangeKey

    Application 01:00:00 selected.

    App key settings:
    change key: master key
    configuration changeable: True
    create / delete without master key : False
    directory list access without master key: True
    allow change master key: True
    max No of keys: 1
    key type: DESorTwoKey3DES

    Aughenticating using key No. 0 with key: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
    Authentication succeeded.
    Session Key: D0:22:A6:D2:D6:A4:7F:DA:18:D8:D6:ED:01:C0:84:8E

    Preparing encrypted data for new key No. 0 with new key: 01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F:10
    Calculated CRC16 on new key: 0E:1B
    New key data before encryption: 01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F:10:0E:1B:00:00:00:00:00:00
    New key data after encryption: A8:E0:B7:B6:F6:B9:51:30:09:0B:09:5D:96:9F:9C:2A:C1:50:36:BD:2E:9A:8A:4D

    Error: CRC or MAC does not match data / Padding bytes not valid

    Is there any sample source code available for the correct CRC algorythm to be used (C# or

    Has anyboday any hints on what I am doing wrong?
    + 0  |  - 0
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.