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.