AuthenticateAES and SAM_AuthenticatePICC

Forum / MIFARE general topics and applications / AuthenticateAES and SAM_AuthenticatePICC

  • 3. September 2018 at 13:11
    I am using non-X feature of SAM AV2 to authenticate PICC.
    The test key as below:
    - Key Type: AES-128
    - Master Key: AA23456789B123456789C123456789F1
    - DivInput: 11223344556677889900AABBCCDDEEFF
    - ==> Derived Key: DK_Key = 85590B30E62662579A67C29655E6173A

    Authentication logs as below:
    1. AuthenticateAES Part 1
    >>PICC 90 aa 00 00 01 02 00
    < rndB = decrypt(DK_Key, 29 48 c6 5a 76 e1 3e cf 6e 3c b6 00 7f 3d 1e 0c)
    rndB = 8E 35 E4 17 AD 3B A3 D3 2E 00 B9 0A 47 C6 BD F0

    2. SAM_AuthenticatePICC Part 1
    >>SAM 80 0A 01 00 22 02 00 29 48 C6 5A 76 E1 3E CF 6E 3C B6 00 7F 3D 1E 0C 11 22 33 44 55 66 77 88 99 00 AA BB CC DD EE FF 00
    < rndA || rndB' = decrypt(DK_Key, CC FB 00 2F F9 0E CC 1A 2E 6E FB 13 F8 D8 C7 99 16 5B B4 37 68 A6 4F CC 8E 6F C6 AC 7B 57 D3 7B)
    rndA || rndB'= A5 4F 40 DD 18 D8 93 5C 0F 66 AF B4 4E 1E 10 25 35 E4 17 AD 3B A3 D3 2E 00 B9 0A 47 C6 BD F0 8E
    rndA = A5 4F 40 DD 18 D8 93 5C 0F 66 AF B4 4E 1E 10 25
    rndB' = 35 E4 17 AD 3B A3 D3 2E 00 B9 0A 47 C6 BD F0 8E

    At this step, both PICC and SAM processes encryption/decryption for rndB correctly.
    It seems that PICC and SAM should mutual authenticate successfully.

    However for part 2 of the authentication, PICC and SAM give different rndA
    3. AuthenticateAES Part 2
    >>PICC 90 af 00 00 20 cc fb 00 2f f9 0e cc 1a 2e 6e fb 13 f8 d8 c7 99 16 5b b4 37 68 a6 4f cc 8e 6f c6 ac 7b 57 d3 7b 00
    <>SAM 80 0A 00 00 10 4C CE 23 D3 F6 F1 02 79 AC 8B 7B E3 5E 58 B6 D7
    <<SAM 90 1E

    What wrong with AuthenticateAES and SAM_AuthenticatePICC as shown above?

    Thanks,
    + 0  |  - 0

    Re: AuthenticateAES and SAM_AuthenticatePICC

    4. September 2018 at 8:33
    Hi Nhuttrung,

    The authentication is not trivial to implement. I recommend to study one of our AN’s for the PICC you want to use. For instance:

    AN1826 – MIFARE SAM AV2 for MIFARE DESFire EV1

    We have other AN’s for using a MIFARE Classic, Plus and Ultralight. In this AN you will find examples for authentication, change of keys and reading and writing in MACed and encrypted communication mode.

    The TapLinx team
    + 0  |  - 0
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.