Sam AV2 SAM_ChangeKeyEntry problem

Forum / MIFARE SmartCard IC`s / Sam AV2 SAM_ChangeKeyEntry problem

  • 8. October 2015 at 13:48
    Hello!

    I'm trying to personalize blank SAM (according to an182311) with NxpRdLib.

    I have successfully done SAM_AuthenticateHost with TDEA DESFire default key (number 0, ver 0), for SAM_LC0. Next I've tried to switch this key to AES128 type.
    But I've got 69h 85h error for SAM_ChangeKeyEntry. I dont understand why :(


    Here is my data exchange:
    Authenticate host

    SAM_AuthenticateHost
    SAM Command :0x80 0x64 0x0 0x0 0x0
    SAM Response :0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0xff 0x0 0x0 0x90 0x0
    SAM Command :0x80 0xa4 0x0 0x0 0x2 0x0 0x0 0x0
    SAM Response :0x36 0x67 0x46 0xfa 0x4c 0xba 0x3d 0xdc 0x90 0xaf
    SAM Command :0x80 0xa4 0x0 0x0 0x10 0x21 0xa1 0xfd 0x1a 0xa4 0xdb 0xd3 0xdf 0xfa 0x1f 0x8a 0xa 0x50 0x73 0x43 0x75 0x0
    SAM Response :0x96 0x8d 0xa5 0xc0 0xe 0x4f 0xa6 0x92 0x90 0x0

    Make data for Sam_ChangeKeyEntry
    CalculateCrc16
    state crc==0 crc=e829
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 20 00 00 00 00 00 E8 29 00
    Encrypt
    22 1E 43 A3 CC 0C F4 33 AB C0 42 96 F8 6C 90 CB 36 04 B0 53 BD B3 0F 78 92 52 DD 7E A0 29 83 7E 0B 08 70 29 F8 36 B6 35 43 C5 6F 33 AC 47 79 0D 78 D2 2C 40 37 2B 1B E5 15 B6 2E BD 0B 5F 5A FC

    Call SAM_ChangeKeyEntry
    SAM_ChangeKeyEntry
    SAM Command :0x80 0xc1 0x0 0xff 0x48 0x22 0x1e 0x43 0xa3 0xcc 0xc 0xf4 0x33 0xab 0xc0 0x42 0x96 0xf8 0x6c 0x90 0xcb 0x36 0x4 0xb0 0x53 0xbd 0xb3 0xf 0x78 0x92 0x52 0xdd 0x7e 0xa0 0x29 0x83 0x7e 0xb 0x8 0x70 0x29 0xf8 0x36 0xb6 0x35 0x43 0xc5 0x6f 0x33 0xac 0x47 0x79 0xd 0x78 0xd2 0x2c 0x40 0x37 0x2b 0x1b 0xe5 0x15 0xb6 0x2e 0xbd 0xb 0x5f 0x5a 0xfc 0xa9 0xa6 0x96 0xcf 0x67 0xa5 0x4c 0x84
    SAM Response :0x69 0x85
    + 0  |  - 1

    Re: Sam AV2 SAM_ChangeKeyEntry problem

    22. December 2016 at 9:33
    Hi Vasily,

    Have you figured out the reason of your problem ? I'm just starting dealing with the AV2 and I'm facing the same "issue".

    Thanks in advance.
    Florian
    + 0  |  - 0

    Re: Sam AV2 SAM_ChangeKeyEntry problem

    4. January 2017 at 10:12
    Hi Vasily,

    You have to enter the complete sequence. In my example I do first a SAM_GetKeyEntry() and then a SAM_ChangeKeyEntry() to an AES128 key:

    SentFrmHost(5) = 80 64 01 00 00)
    phbalReg_Exchange [ENTRY] (wOption = DEFAULT, pTxBuffer(5) = 80 64 01 00 00, wRxBufSize(2) = 01 05)
    phbalReg_Exchange [LEAVE] (pRxBuffer(15) = 00 00 00 00 00 00 00 00 00 FF 20 02 00 90 00) = SUCCESS

    GivenToHost(15) = 00 00 00 00 00 00 00 00 00 FF 20 02 00 90 00)
    phhalHw_GetConfig [ENTRY] (bCompId(1) = 03, wConfig(2) = E0 00)
    phhalHw_GetConfig [LEAVE] (pValue(2) = 00 02) = SUCCESS

    SentFrmHost(66) = 80 C1 01 FF 3D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 20 00 00 00 00 00)
    phbalReg_Exchange [ENTRY] (wOption = DEFAULT, pTxBuffer(66) = 80 C1 01 FF 3D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 20 00 00 00 00 00, wRxBufSize(2) = 01 05)
    phbalReg_Exchange [LEAVE] (pRxBuffer(2) = 90 00) = SUCCESS

    GivenToHost(2) = 90 00)


    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.