5.10.6. MIFARE DESFire EV2 : Diversified Change Key

Warning

To run this example, you would need the nxpnfcrdlib component for which a Non-Disclosure Agreement(NDA) needs to be signed. Please contact your FAE for additional details.

5.10.6.1. Prerequisites

Note : Order of execution se05x_Ev2PrepareCard, se05x_Ev2PrepareSE, se05x_Ev2ChangeKey, se05x_Ev2DivChngKey.

5.10.6.2. About the Example

This project demonstrates the Mifare Desfire EV2 Diversified ChangeKeyEv2 using Se05x. The Key is diversified using the card UID After changing Keys.

It uses the following APIs and data types:

5.10.6.3. Running the Demo

  1. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo

If everything is setup correctly the output would be as follows:

App   :INFO :PlugAndTrust_v03.03.01_20210923
sss   :INFO :atr (Len=35)
                01 A0 00 00     03 96 04 03     E8 00 FE 02     0B 03 E8 00
                01 00 00 00     00 64 13 88     0A 00 65 53     45 30 35 31
                00 00 00
sss   :WARN :Communication channel is Plain.
sss   :WARN :!!!Not recommended for production use.!!!
App   :INFO :Sleeping for 10 seconds for debugger stabilization
App   :INFO :UID after L3 Activation (Len=10)
                08 B0 2D 07     00 00 00 00     00 00
App   :INFO :ATS after L4 Activation (Len=6)
                06 75 77 81     02 80
App   :INFO :Auth with the  cardkey 0 and getting the card UID for diversification
App   :INFO :Select the AFC Application Successful

App   :INFO :attempting to authenticate with cardkey = 0 and Se0Obj ID = 2103308292
App   :INFO :
 CARD =====> SE050   16-byte Ek(RndB)  =
 (Len=16)
                77 49 69 E2     D6 18 45 30     1E 0F 4F 72     D1 E9 B9 84
App   :INFO :
  CARD <====== SE050  E(Kx, RandA || RandB') =
 (Len=32)
                B9 B3 51 0D     74 20 0B 35     7B 3B 39 2E     01 CB 4B 67
                06 6B BF 1F     EF A8 EC 96     43 F3 6A 3C     F6 1F 11 41
App   :INFO :
  CARD ======> SE050  32-byte E(Kx, TI||RndA'||PDCap2||PCDcap2) =
 (Len=32)
                56 2C 7D A1     EF C4 69 F6     A6 03 01 51     C8 6B 87 4C
                43 45 05 CD     09 F6 D2 5A     19 EC B1 BC     5C 08 12 6E
App   :INFO :
  CARD <====== SE050  E(Kx, RandA || RandB') =
 (Len=12)
                00 00 00 00     00 00 00 00     00 00 00 00
App   :INFO :Dumped Session Key is (Len=16)
                67 3B 5B D7     F6 86 98 30     A3 A0 58 4F     5E 90 5C 8A
App   :INFO :Dumped Session Mac is (Len=16)
                69 32 00 28     7C 49 BE 6B     33 46 A6 7A     B8 22 9F AA
App   :INFO :Dumped TI is (Len=4)
                17 74 87 8B
App   :INFO :pDataParams->wCmdCtr=0
App   :INFO : EV2 First Authenticate  Successful

App   :INFO :CARD UID will be used for diversification
App   :INFO :Select the AFC Application Successful

App   :INFO :attempting to authenticate with cardkey = 0 and Se0Obj ID = 2103308292
App   :INFO :
 CARD =====> SE050   16-byte Ek(RndB)  =
 (Len=16)
                B7 E3 A7 BD     90 7B FD 23     93 22 9D 65     58 BD 73 69
App   :INFO :
  CARD <====== SE050  E(Kx, RandA || RandB') =
 (Len=32)
                9D 5F 6B 65     A5 33 80 CF     71 35 4E FE     A7 8D 08 88
                34 6A 41 F5     C8 17 C8 F2     D0 6A 7B D5     2F FF E4 5F
App   :INFO :
  CARD ======> SE050  32-byte E(Kx, TI||RndA'||PDCap2||PCDcap2) =
 (Len=32)
                1B 88 5F 4F     56 CE F3 1F     B5 14 74 27     A9 7D 7F 34
                8B 0C 96 80     B6 23 06 9A     23 F8 98 CF     FB 3D 62 0B
App   :INFO :
  CARD <====== SE050  E(Kx, RandA || RandB') =
 (Len=12)
                00 00 00 00     00 00 00 00     00 00 00 00
App   :INFO : EV2 First Authenticate  Successful

App   :INFO :
 CARD =====> SE050   16-byte Ek(RndB)  =
 (Len=16)
                D2 BF 2C 15     7E 2F 24 86     2E D1 96 49     50 E1 61 C2
App   :INFO :
  CARD <====== SE050  E(Kx, RandA || RandB') =
 (Len=32)
                2B 44 7C ED     65 44 29 D9     74 75 63 4E     49 5B 79 D5
                D5 95 F6 0D     AD 43 FE 73     5E 90 EF C3     AB BC 00 CF
App   :INFO :
  CARD ======> SE050  32-byte E(Kx, TI||RndA'||PDCap2||PCDcap2) =
 (Len=16)
                D5 EA 02 26     02 BB 0B DC     1E 57 95 02     E9 E3 51 25
App   :INFO : EV2 Following Authenticate  Successful

App   :INFO :Authenticated with cardkey = 0 and Se0Obj ID = 2103308292
App   :INFO :attempting to change cardkey = 0 from  Old Se050ObjID= 0 to new Se050ObjID= 2103308294
App   :INFO : Change Key for card key 0 is Successful to Se050ObjID= 2103308294

App   :INFO : Auth session is reset in software
App   :INFO : Auth session is killed in SE
App   :INFO :ex_sss Finished