What's differences are between the TDEA -Desfire and the TDEA-ISO10116(crc16) -k

Forum / MIFARE SDK / What's differences are between the TDEA -Desfire and the TDEA-ISO10116(crc16) -k

  • 3. February 2017 at 7:31
    What's differences are between the TDEA-Desfire and the TDEA-ISO10116(crc16) -key types ?
    When I try to authenticate (keytype = TDEA-ISO10116(crc16)) with Mifare SAM-AV2 using APDU -commands (Reader= Omnikey5421 - pcsc):
    Step 1:
    80 A4 00 00 02 00 01 00 - it's give the response (challenge)data and success (sw1 and sw2 = 90 AF)
    Step 2:
    but the next (after the TDEA operation for the SAM challenge) command:
    80 A4 00 00 10 xx...xx (the response is 0x90 0x1E = authentication failed) ?

    But if I use the MIFAREdiscover (the result is ok):

    [2.2.2017 13:41:15] Info: SentFrmHost(8) = 80 A4 00 00 02 00 01 00)
    [2.2.2017 13:41:15] Info: phbalReg_Exchange [ENTRY] (wOption = DEFAULT, pTxBuffer(8) = 80 A4 00 00 02 00 01 00, wRxBufSize(2) = 01 05)
    [2.2.2017 13:41:15] Info: phbalReg_Exchange [LEAVE] (pRxBuffer(10) = FC D5 B9 85 EA 22 95 09 90 AF) = SUCCESS

    [2.2.2017 13:41:15] Info: GivenToHost(10) = FC D5 B9 85 EA 22 95 09 90 AF)
    [2.2.2017 13:41:15] Info: SentFrmHost(22) = 80 A4 00 00 10 10 78 F0 F3 2E AF 7F D8 16 A8 83 1B 96 8A 54 94 00)
    [2.2.2017 13:41:15] Info: phbalReg_Exchange [ENTRY] (wOption = DEFAULT, pTxBuffer(22) = 80 A4 00 00 10 10 78 F0 F3 2E AF 7F D8 16 A8 83 1B 96 8A 54 94 00, wRxBufSize(2) = 01 05)
    [2.2.2017 13:41:15] Info: phbalReg_Exchange [LEAVE] (pRxBuffer(10) = 54 4E E5 04 31 96 9D 86 90 00) = SUCCESS

    [2.2.2017 13:41:15] Info: GivenToHost(10) = 54 4E E5 04 31 96 9D 86 90 00)
    [3.2.2017 7:34:01] Info: phbalReg_ClosePort [ENTRY] ()
    [3.2.2017 7:34:01] Info: phbalReg_ClosePort [LEAVE] () = SUCCESS


    + 0  |  - 0

    Re: What's differences are between the TDEA -Desfire and the TDEA-ISO10116(crc16) -k

    3. February 2017 at 13:54
    Hi Juha,

    The MIFARE DESFire EV1 define three cipher modes: DES/2K3DES (also called as 2TDES), 3K3DES (also called as 3TDES) and AES128. The first DESFire (before EV1) only supports DES/2K3DES. 2K3DES uses two unique keys but 3K3DES three keys.

    TDEA-ISO10116 is an international standard for block cipher and the modes.

    2K3DES and 3K3DES are enhancements to fix the weakness of the original DES cipher. There exists papers which describes the “effective key length” of 3K3DES is only 112 bit (refer e.g. Wikipedia: https://en.wikipedia.org/wiki/Triple_DES ). If you use for instance 2K3DES in TapLinx, the upper and the lower 8 byte key pair have to be different. But this makes it impossible change the default key (all key pairs zero) as 2K3DES key. Here you have to use 3K3DES to change to a unique value.

    With all this restrictions and the general weakness of DES I have one recommendation: if you not have to be compatible to an existing infrastructure, please prefer always AES128!

    You use the MIFARE SAM AV2. I would use a host key (for the AuthenticateHost command) an AES192 key.

    Regards,
    The TapLinx team.

    + 0  |  - 0

    Re: What's differences are between the TDEA -Desfire and the TDEA-ISO10116(crc16) -k

    4. February 2017 at 12:49
    Yes,but how must take attention the crc16 (in the algorithm) when create the response for the SAM (80 a4 00 00 10 10 xx xx ... xx) ?
    ..because the same function works ok when key type is TDEA-Desfire, but not when key type is TDEA-ISO10116(crc16) ?
    + 0  |  - 0

    Re: What's differences are between the TDEA -Desfire and the TDEA-ISO10116(crc16) -k

    6. February 2017 at 10:30
    If I use below steps in the AuthenticateHost (key type= TDEA-ISO10116(crc16):
    STEPS:
    1.send initial authentication request to the SAM - 80 A4 00 00 02 00 01 00
    2.get encrypted (randB) from response
    3.16 bytes default key (known key value)
    4. Keys for 3DES
    5. decrypt encoded randB
    6. generate randA
    7. decrypt randA
    8. shift randB 1 byte left and get randB'
    9. XOR randB' with randA and decrypt
    10. concat (randB' + randA)
    11. send (randB' + randA) to the SAM - 80 A4 00 00 10 xx xx ... xx

    But result is (sw1 and sw2 = 90 1E) ?

    So, something wrong must be in decrypt -methods ? (cipherMode.CBC or ?) or what means crc16 in the key type ?

    + 0  |  - 0

    Re: What's differences are between the TDEA -Desfire and the TDEA-ISO10116(crc16) -k

    6. February 2017 at 15:50
    Hello Juha,

    The NXP application note AN1823 “MIFARE SAM AV2 – Key Management and Personalization” explains in chapter 2 “Key types and classes”: that the Host Key can only be of type AES128 or AES192. Only the Host Key can be used in commands SAM_AuthenticateHost, SAM_LockUnlock etc.

    As I said in my previous post, you should not spend a lot of effort to use “weak” keys 2K3DES or 3K3DES. You can use this keys to authenticate to a PICC only.

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

You must be logged in to reply to this topic.