Decryption of ReadData Response does not output the expected result for NTAG 424

cancel
Showing results for 
Search instead for 
Did you mean: 

Decryption of ReadData Response does not output the expected result for NTAG 424

95 Views
Contributor I

I am trying to decrypt the response data from ReadData (FileNo 03) Command using AN12196.

I have successfully authenticated myself and also successfully send the read data (SW1 91 SW2 00)

But I cannot encrypt the data as expected.

What I send via APDU

INSCLA: 90 -- INSCODE: ad -- p1: 00 -- p2: 00 -- data: 030000000000002c959ad85afdebb2 -- le: 256

SW1: 91, SW2 00

What I get:

b4173043af196e3140a67efb0bf051d84264fd86b439688302c0648bb46196044ce2329e0bb0880df3948f7ab315e9acbcfe36caf02ff499a5ed61b86c625012da89b18d0c4975d2e18f765c254c14d1216779d43f94f871a516497879bc9550e37ae4357abca8e8f63c5e0d8f2e97e9a8120cec73f5fa6c309e40fbd7f1bf4df3c95960b8a852bfa7f8a87c63b0653a05ec9ad9afcbef32

Relevant data to decrypt it:

SESAUTHENC: 5de37b95b1e54b312883e2302ee659d4

SESAUTHMAC: ff831facdfea267567eabb827b266b1f

TI: 1595b419

CMD: AD

CMDCTR: 0100

What the result should be (plain data in FileNo3) in hex:

68656C6C6F776F726C6430303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030

But I get:

fce6560788d457e8b732928c7a6752f2b9b3a445e71a778874cc057fbd93e529c15c29115568c60d847a7d86a6c56c3550bd15b887479e279462c567af4dd14a1ae560c839efc52a96813af882ab610ec96d3227ec17f10cc8c89014fbe28604aad975b13355f3bf7ae2c544e1525190ab360488213cd156e3414c26393a72197dba828e8a544260fd3cd91fe0ae20ad

I would really appreciate a calculation on how to get the expected result. Thank you very much in advance.

0 Kudos
1 Reply

1 View
NXP TechSupport
NXP TechSupport

Hi Ibrahim Atli,

Please check the  following process I did on an NTAG I have  and a Pegoda reader :

Basically I send the select command then authenticate using the key 02 then read the  file no E105, full enciphered.

phpalI14443p3a_ActivateCard--------ENTRY--------  
phpalI14443p3a_ActivateCard--------LEAVE-------- pUidOut=044D0F2AAA6180   pSak=20   pMoreCardsAvailable=00   [STATUS = SUCCESS]


phpalI14443p4a_ActivateCard--------ENTRY-------- bFsdi=08   bCid=00   bDri=00   bDsi=00  
Send to card: E080
Recv from card: 067777710280
phpalI14443p4a_ActivateCard--------LEAVE-------- pAts=067777710280   [STATUS = SUCCESS]


phalMfNtag42XDna_IsoSelectFile--------ENTRY-------- bOption=0C   bSelector=04   pFid=10E1   pFid=10E1   bDFnameLen=07   pDFname=D2760000850101  

phpalI14443p4_Exchange--------ENTRY-------- wOption=8000   pTxBuffer=00A4040C07
phpalI14443p4_Exchange--------LEAVE-------- [STATUS = SUCCESS]


phpalI14443p4_Exchange--------ENTRY-------- wOption=C000   pTxBuffer=D2760000850101
phpalI14443p4_Exchange--------LEAVE-------- [STATUS = SUCCESS]

Send to card: 00A4040C07D276000085010100

phpalI14443p4_Exchange--------ENTRY-------- wOption=4000   pTxBuffer=00
phpalI14443p4_Exchange--------LEAVE-------- ppRxBuffer=9000   [STATUS = SUCCESS]

Recv from card: 9000
phalMfNtag42XDna_IsoSelectFile--------LEAVE-------- [STATUS = SUCCESS]


phKeyStore_FormatKeyEntry--------ENTRY-------- wKeyNo=0000   wNewKeyType=0000
phKeyStore_FormatKeyEntry--------LEAVE-------- [STATUS = SUCCESS]


phalMfNtag42XDna_AuthenticatEv2--------ENTRY-------- bAuthOption=01   wOption=FFFF   wKeyNo=0000   wKeyVer=0000   bKeyNoCard=02      

phpalI14443p4_Exchange--------ENTRY-------- wOption=8000   pTxBuffer=9071000002
phpalI14443p4_Exchange--------LEAVE-------- [STATUS = SUCCESS]


phpalI14443p4_Exchange--------ENTRY-------- wOption=C000   pTxBuffer=0200
phpalI14443p4_Exchange--------LEAVE-------- [STATUS = SUCCESS]

Send to card: 9071000002020000

phpalI14443p4_Exchange--------ENTRY-------- wOption=4000   pTxBuffer=00
phpalI14443p4_Exchange--------LEAVE-------- ppRxBuffer=49E8B5B65DA68CD6B03B95F3CE04039491AF   [STATUS = SUCCESS]

Recv from card: 49E8B5B65DA68CD6B03B95F3CE04039491AF

phpalI14443p4_Exchange--------ENTRY-------- wOption=8000   pTxBuffer=90AF000020
phpalI14443p4_Exchange--------LEAVE-------- [STATUS = SUCCESS]


phpalI14443p4_Exchange--------ENTRY-------- wOption=C000   pTxBuffer=C60DCEBB5C0DB1A87E0A666027CE48AAB6C7A9A900DB45070238F899FD278417
phpalI14443p4_Exchange--------LEAVE-------- [STATUS = SUCCESS]

Send to card: 90AF000020C60DCEBB5C0DB1A87E0A666027CE48AAB6C7A9A900DB45070238F899FD27841700

phpalI14443p4_Exchange--------ENTRY-------- wOption=4000   pTxBuffer=00
phpalI14443p4_Exchange--------LEAVE-------- ppRxBuffer=9654BCFFC18FE0F2F31C875F554E39D742694FC33D4723D956BE9027815584D49100   [STATUS = SUCCESS]

Recv from card: 9654BCFFC18FE0F2F31C875F554E39D742694FC33D4723D956BE9027815584D49100
phalMfNtag42XDna_AuthenticatEv2--------LEAVE-------- bPcdCapsOut=000000000000   bPdCapsOut=000000000000   [STATUS = SUCCESS] AUTHENTICATED 


phalMfNtag42XDna_ReadData--------ENTRY-------- bOption=30   bIns=01   bFileNo=03   pOffset=000000   pLength=000000  

phpalI14443p4_Exchange--------ENTRY-------- wOption=8000   pTxBuffer=90AD00000F
phpalI14443p4_Exchange--------LEAVE-------- [STATUS = SUCCESS]


phpalI14443p4_Exchange--------ENTRY-------- wOption=C000   pTxBuffer=030000000000002B703C65E2AB43AE
phpalI14443p4_Exchange--------LEAVE-------- [STATUS = SUCCESS]

Send to card: 90AD00000F030000000000002B703C65E2AB43AE00

phpalI14443p4_Exchange--------ENTRY-------- wOption=4000   pTxBuffer=00
phpalI14443p4_Exchange--------LEAVE-------- ppRxBuffer=5267C01B2524CCCA9B8BCC3B9077509B3F623511E17586913A8C7BDDA1F7D396E1CC0EDB97F4B68BB545F64662E2930CFF46C24FAAECFE5416F0FAF2E553706FDD6B4F2FF53149AFC0D10899D39042ACFCBC51292AC852EF5E44A435F8167DA85F0A81A91A3CD5B557DB64321D99C54D97B1AC26C7EE5DA2721EC95F6732E11BDE5288965CDEBFA7D6A6FF46DE4DB097E8865EFA53B6A2FA9100   [STATUS = SUCCESS]

Recv from card: 5267C01B2524CCCA9B8BCC3B9077509B3F623511E17586913A8C7BDDA1F7D396E1CC0EDB97F4B68BB545F64662E2930CFF46C24FAAECFE5416F0FAF2E553706FDD6B4F2FF53149AFC0D10899D39042ACFCBC51292AC852EF5E44A435F8167DA85F0A81A91A3CD5B557DB64321D99C54D97B1AC26C7EE5DA2721EC95F6732E11BDE5288965CDEBFA7D6A6FF46DE4DB097E8865EFA53B6A2FA9100
phalMfNtag42XDna_ReadData--------LEAVE-------- ppRxdata=007E000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000   [STATUS = SUCCESS]‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
Have a great day !

BR

Jonathan

0 Kudos