Reputation: 39
Iam trying to read the Events_Data file on a digital tachograph smartcard which is documented in the EG Nr.1360-2002 (page 120). Its size can vary from 864 to 1728 bytes. Now iam trying to find out the exact size on a testcard. I tried following the steps descriped in this SO article, but the SELECT command for these kind of cards seems to only work with P2=0C (no response expected). Is there another way to find out the size of these files?
Upvotes: 0
Views: 902
Reputation: 4047
From my understanding of the specification:
but the SELECT command for these kind of cards seems to only work with P2=0C (no response expected)
I agree. Page 36 states it supports Standards ISO 7816, but page 105 stated that the Select File APDUs are limited (can not have response data, only SW=9000 or error)
Its size can vary from 864 to 1728 bytes.
Basically, there are 6 CardEventRecords, each of them consisting of n1 (6 to 12) CardEventRecord (24 bytes). Therefore, there are 36 to 72 CardEventRecord in this file.
I tried following the steps descriped in this SO article
In this case you can read the first 864 bytes (to speed up just send 4 APDUs to read firstt 255 bytes, next 255 bytes, next 255 bytes, and next 99 bytes). Afterward, do loop to read the rest of bytes every 24 bytes (CardEventRecord) and stop if you receive SW 6B00 or 6700.
NOTE: You can also do block reading 255 bytes for all bytes, and when you get error 6CXX, resend the read APDU using short length indicated by XX. This should be faster, but the card may send SW 6700 instead of 6CXX which is not convenient (depends on card implementation).
Upvotes: 1