How to read an ATR from a smartcard Example ATR: 3b 13 40 28 35 11 80 TS T0 TD1 TC2 TCK |----------| <-- historical bytes This card uses regular convention, has 3 historical bytes, and a working waiting time of 28. TS, T0 are all that is absolutely required. TS determines whether the card is 'regular convention' or inverse convention. '3b' is 'regular convention'. '3f' is 'inverse convention'. T0 determines what other protocol bytes are transmitted and how many historical bytes are transmitted. The higher half of the bits constitute a bitmask that determines which of TA1, TB1, TC1 and/or TD1 are transmitted. The lower half of the bits determine the number of historical bytes in the ATR. TA1 does something. TB1 does some stuff regarding power. TC1 does some stuff. TDi determines the transmission protocol used and what further protocol bytes will be transmitted. The higher half of the bits comprise a bitmask for which of TA(i+1) will be transmitted. The lower half of the bits determine the protocol, (T=0 thru T=14). TC2 determines the working waiting time for a card. The default is 10, if TC2 is not set. Historical Bytes can be anything and are vendor dependent. TCK The last byte is supposed to be a check byte (TCK). It may or may not be. ;) TCK is an XOR of all bytes starting from T0 and up to the end of the ATR. (See page 164 of Rankl & Effing's "Smart Card Handbook" for a more thorough description.)
|