An Answer To Reset (ATR) is a message output by a contact
Smart Card
A smart card, chip card, or integrated circuit card (ICC or IC card) is a physical electronic authentication device, used to control access to a resource. It is typically a plastic credit card-sized card with an embedded integrated circuit (IC) c ...
conforming to
ISO/IEC 7816
ISO/IEC 7816 is an international standard related to electronic identification cards with contacts, especially smart cards, and more recently, contactless mobile devices, managed jointly by the International Organization for Standardization (ISO) ...
standards, following
electrical reset of the card's chip by a card reader. The ATR conveys information about the communication parameters proposed by the card, and the card's nature and state.
By extension, ATR often refers to a message obtained from a Smart Card in an early communication stage; or from the card reader used to access that card, which may transform the card's message into an ATR-like format (this occurs e.g. for some
PC/SC PC/SC (short for "Personal Computer/Smart Card") is a specification for smart-card integration into computing environments.
Microsoft has implemented PC/SC in Microsoft Windows 200x/XP and makes it available under Microsoft Windows NT/9x.
A free im ...
card readers when accessing an
ISO/IEC 14443
ISO/IEC 14443 ''Identification cards -- Contactless integrated circuit cards -- Proximity cards'' is an international standard that defines proximity cards used for identification, and the transmission protocols for communicating with it.
Standa ...
Smart Card).
The presence of an ATR is often used as a first indication that a Smart Card appears operative, and its content examined as a first test that it is of the appropriate kind for a given usage.
Contact Smart Cards communicate over a signal named Input/Output (I/O) either ''synchronously'' (data bits are sent and received at the rhythm of one per period of the clock supplied to the card on its CLK signal) or ''asynchronously'' (data bits are exchanged over I/O with another mechanism for bit delimitation, similar to traditional
asynchronous serial communication
Asynchronous serial communication is a form of serial communication in which the communicating endpoints' interfaces are not continuously synchronized by a common clock signal. Instead of a common synchronization signal, the data stream contai ...
). The two modes are exclusive in a given communication session, and most cards are built with support for a single mode. Microprocessor-based contact Smart Cards are mostly of the asynchronous variety, used for all
Subscriber Identity Module
A typical SIM card (mini-SIM with micro-SIM cutout)
A GSM mobile phone
file:Simkarte NFC SecureElement.jpg, T-Mobile nano-SIM card with NFC capabilities in the SIM tray of an iPhone 6s
file:Tf sim both sides.png, A TracFone Wireless SIM card ha ...
s (SIM) for mobile phones, those
bank card
A bank card is typically a plastic card issued by a bank to its clients that performs one or more of a number of services that relate to giving the client access to bank account.
Physically, a bank card will usually have the client's name, the ...
s with contacts that conform to
EMV
EMV is a payment method based on a technical standard for smart payment cards and for payment terminals and automated teller machines which can accept them. EMV stands for " Europay, Mastercard, and Visa", the three companies that created th ...
specifications, all contact
Java Card
Java Card is a software technology that allows Java platform, Java-based applications (applets) to be run securely on smart cards and more generally on similar secure small memory footprint deviceswhich are called “secure elements” (SE). To ...
s, and Smart Cards for
pay television
Pay television, also known as subscription television, premium television or, when referring to an individual service, a premium channel, refers to Subscription business model, subscription-based television services, usually provided by multichan ...
. Memory-only cards are generally of the synchronous variety.
ATR under asynchronous and synchronous transmission have entirely different form and content. The ATR in asynchronous transmission is precisely normalized (in order to allow interoperability between cards and readers of different origin), and relatively complex to parse.
Some Smart Cards (mostly of the asynchronous variety) send different ATR depending on if the reset is the first since power-up (''Cold ATR'') or not (''Warm ATR'').
Note: Answer To Reset should not be confused with ATtRibute REQuest (ATR_REQ) and ATtRibute RESponse (ATR_RES) of NFC
NFC may refer to:
Psychology
* Need for cognition, in psychology
* Need for closure, social psychological term
Sports
* NFC Championship Game, the National Football Conference Championship Game
* NCAA Football Championship (Philippines)
* Nati ...
, also abbreviated ATR. ATR_RES conveys information about the communication parameters supported, as does Answer To Reset, but its structure is different.
ATR in asynchronous transmission
The standard defining the ATR in asynchronous transmission is ISO/IEC 7816-3. Subsets of the full ATR specification are used for some Smart Card applications, e.g. EMV.
Physical form and timing at the card/reader interface
In asynchronous transmission, the ATR is transmitted by a card to a reader as characters, encoded as bits over the contact designated I/O (C7), with a nominal bit duration denoted Elementary Time Unit (ETU), equal during the whole ATR to 372 periods of the clock signal supplied by the reader on the CLK (C3) contact. The I/O line is by default at a H state (the highest voltage of two
logic levels
Logic is the study of correct reasoning. It includes both formal and informal logic. Formal logic is the science of deductively valid inferences or of logical truths. It is a formal science investigating how conclusions follow from premises ...
), and a transition to L state, denoted leading edge, defines the start of a character. The leading edge of the first character occurs between 400 and 40 000 clock cycles after the reader changed the RST (C2) contact from L to H.
Each characters comprises a start bit at L state, 8 data bits, 1 parity bit, followed (absent error) by a delay at the H state (a high voltage on I/O) such that the leading edge of characters in the ATR is at least 12 ETU, with maximum designated Waiting Time WT = 9 600 ETU during the whole ATR (Eurocard MasterCard Visa specifications add that the reader should tolerate 10 800 ETU, that is 5% more). The value of the byte encoded by a character is defined according to conventions determined by the first character of the ATR, designated TS.
The end of the physical ATR between card and reader can be determined by the reader using analysis on the fly of the values of TS, T0, and any TD
''i'' (see below), or/and on the basis of WT. The later method incurs an extra delay (about 0.8 s at the maximum clock frequency of 5 MHz applicable during ATR). EMV (but not ISO/IEC 7816-3) also allows the reader to consider that the ATR must be over after 20 160 ETU (about 1.5 s at 5 MHz) counted from the leading edge of TS.
Note: When communicating in asynchronous mode with an ISO/IEC 7816-3 contact Smart Card using a serial interface device operating per direct convention (such as a standard UART
A universal asynchronous receiver-transmitter (UART ) is a computer hardware device for asynchronous serial communication in which the data format and transmission speeds are configurable. It sends data bits one by one, from the least significan ...
), it can be set to 8 bits, 1 even parity bit, 2 stop bits (sometime negotiable to 1, see TC1); during the ATR, the baud rate should be 1/372 of the clock frequency received by the card (corresponding to an ETU of 372 clock cycles). There will normally be no parity error or framing error. The first byte received is if the card operates in direct convention, if the cards operates in inverse convention, in which case the polarity and order of all 8 bits of each byte going through the serial interface device should be reversed, which in particular will change the first byte to .
Historical note: provision for cards that use an internal clock source and a fixed ETU of 1/9 600 second during ATR existed in ISO/IEC 7816-3:1989, and was removed from the 1997 edition onwards.
General structure
The ATR proceeds in five steps: initial character TS; format byte T0; interface bytes TA
''i'', TB
''i'', TC
''i'', TD
''i'' (optionals, variable number); historical bytes T
''i'' (optionals, up to 15), and the check byte TCK (optional). There are a total of 2 to 33 characters including TS.
/small> The signification given is assuming ''i'' > 2, and ''i''-1 is the only ''j'' with 1 < ''j'' < ''i'' such that TD''j'' encodes the stated value of T. When that T is in range ..14 the signification of the byte applies only to the corresponding protocol (specific byte). When that T = 15, the signification applies regardless of protocol (global byte).
The initial character TS is always physically present, but is excluded of the Answer-to-Reset in the definition given by ISO/IEC 7816-3:2006: ''the value of the byte string (at most 32 bytes) encoded in the sequence of characters following the initial character TS''. ISO/IEC 7816-4:2005 concurs, stating that TS is a character or synchronization pattern, not a byte. However practice (in PC/SC, EMV, ETSI
The European Telecommunications Standards Institute (ETSI) is an independent, not-for-profit, standardization organization in the field of information and communications. ETSI supports the development and testing of global technical standard ...
, and Calypso at least) is still to consider that TS is part of the ATR, as it was in ISO/IEC 7816-3:1997 and former. In particular, the ATR returned by PC/SC card readers and software stacks includes TS as the first byte, with value or .
Initial character TS
The initial character TS encodes the convention used for encoding of the ATR, and further communications until the next reset. In direct
esp. inverseconvention, bits with logic value are transferred as a High voltage (H)
esp. a Low voltage (L) bits with logic value are transferred as L
esp. H and
least-significant bit
In computing, bit numbering is the convention used to identify the bit positions in a binary number.
Bit significance and indexing
In computing, the least significant bit (LSB) is the bit position in a binary integer representing the binary 1 ...
of each data byte is first (resp. last) in the physical transmission by the card.
For direct convention, TS is and encodes the byte .
For inverse convention, TS is and encodes the byte .
epresents the idle (High, Mark) state of the I/O line. The 8 data bits are shown in ''italic''.
Bits in bytes following TS in the ATR, and further communications until the next reset, are numbered 1st to 8th from low-order to high-order, and their value noted or, regardless of the chronological order and electrical representation, defined by TS. The bit following the 8 data bits in these bytes is an even parity bit, that is such that there's an even number of bits (H or L according to the direct or inverse convention defined by TS) among the 8 data bits and the parity bit.
TS also allows the card reader to confirm or determine the ETU, as one third of the delay between the first and second H-to-L transition in TS. This is optional, and the principal definition of ETU in the ATR of standard-compliant asynchronous Smart Cards is 372 periods of the clock received by the card.
Format byte T0
The Format byte T0 encodes in its 4 low-order bits (4th MSbit to 1st LSbit) the number K of historical bytes T
''i'', in range
..15
It also encodes in its 4 high-order bits the presence of at most 4 other interface bytes: TA
1 (resp. TB
1, TC
1, TD
1) follow, in that order, if the 5th (resp. 6th, 7th, 8th) bit of T0 is.
Interface bytes TA''i'', TB''i'', TC''i'', TD''i''
Interface bytes TA
1, TB
1, TC
1, TD
1, TA
2, TB
2, TC
2, TD
2, TA
3, TB
3, .. are all optional, and encode communication parameters and protocols that the card propose to use.
Interface bytes come in three kinds: ''global'' interface bytes apply to all protocols; ''specific'' interface bytes apply to a specific protocol; and ''structural'' interface bytes introduce further interface bytes, and protocols.
Interface byte TA1
Interface byte TA
1, if present, is global, and encodes the maximum clock frequency f
max supported by the card, and the number of clock periods per ETU that it suggests to use after the ATR, expressed as the ratio Fi/Di of two integers. When TA
1 is absent, it's assumed default value is , corresponding to f
max = 5 MHz, Fi = 372, Di = 1.
The 4 low-order bits of TA
1 (4th MSbit to 1st LSbit) encode Di as:
(#) This was RFU in ISO/IEC 7816-3:1997 and former. Some card readers or drivers may erroneously reject cards using this value (or other RFU). Some PC/SC readers, as a workaround to said driver behavior, clear the 1st bit of TA1 when its 4 low-order bits encode 7, and accordingly adjust TCK (if present), unless they have received a special command.
The 4 high-order bits of TA
1 (8th MSbit to 5th LSbit) encode f
max and Fi as:
(*) Historical note: in ISO/IEC 7816-3:1989, this was assigned to cards with internal clock, with no assigned Fi or f(max).
Note:EMV, and ISO/IEC 7816-3 before the 2006 edition, additionally use the notation DI (resp. FI) for the low-order (respectively high-order) 4 bits of TA
1. DI thus encodes Di, and FI encodes Fi and f
max.
Note: EMV's notation uses D (resp. F) where ISO/IEC 7816-3 uses Di (resp. Fi).
Example: TA
1 = = , in which FI is and DI is, encodes f
max = 10 MHz, Fi = 1024, Di = 16, thus Fi/Di = 1024/16 = 64. This is inviting the card reader to take (after the ATR) the necessary steps to reduce the ETU to 64 clock cycles per ETU (from 372 during ATR) and increase the clock frequency up to 10 MHz (from perhaps 4 MHz during ATR).
Interface byte TB1
TB
1, if present, is global. The usage of TB
1 is deprecated since the 2006 edition of the standard, which prescribes that cards ''should'' not include TB
1 in the ATR, and readers ''shall'' ignore TB
1 if present. EMV still requires that the card includes TB
1 = , and that remains common practice; doing so explicitly indicates that the card does not use the dedicated contact C6 for the purpose of supplying a programming voltage (V
PP) to the card; the cards might however use C6 for Standard or Proprietary Use (SPU), such as communicating with a NFC front end by the Single Wire Protocol (SWP). On the reader side, EMV requires making a ''warm'' ATR for cards with TB
1 other than in the ''cold'' ATR, and handling any TB
1 in a ''warm'' ATR as if it was .
TB
1 was previously indicating (coarsely) the programming voltage V
PP and maximum programming current required by some cards on the dedicated contact C6 during programming of their
EPROM
An EPROM (rarely EROM), or erasable programmable read-only memory, is a type of programmable read-only memory (PROM) chip that retains its data when its power supply is switched off. Computer memory that can retrieve stored data after a power s ...
memory. Modern Smart Cards internally generate the programming voltage for their
EEPROM
EEPROM (also called E2PROM) stands for electrically erasable programmable read-only memory and is a type of non-volatile memory used in computers, usually integrated in microcontrollers such as smart cards and remote keyless systems, or as a ...
or
Flash
Flash, flashes, or FLASH may refer to:
Arts, entertainment, and media
Fictional aliases
* Flash (DC Comics character), several DC Comics superheroes with super speed:
** Flash (Barry Allen)
** Flash (Jay Garrick)
** Wally West, the first Kid ...
memory, and thus do not use V
PP. In the 1997 and earlier editions of the standard:
- The low 5 bits of TB
1 (5th MSbit to 1st LSbit) encode PI1; if TB
2 is absent, PI1 = 0 indicates that the C6 contact (assigned to V
PP) is not connected in the card; PI1 in range
..25encodes the value of V
PP in Volt (the reader shall apply that voltage only on specific demand by the card, with a tolerance of 2.5%, up to the maximum programming current; and otherwise leave the C6 contact used for V
PP within 5% of the V
CC voltage, up to 20 mA); if TB
2 is present, it supersedes the indication given by TB
1 in the PI1 field, regarding V
PP connection or voltage.
- The high bit of TB
1 (8th bits) is reserved, shall be, and can be ignored by the reader.
- The 6th and 5th bits of TB
1 encode the maximum programming current (assuming neither TB
1 nor TB
2 indicate that V
PP is not connected in the card).
(#) This was 100 mA in ISO/IEC 7816-3:1989.
Interface byte TC1
TC
1, if present, is global, and encodes the Extra Guard Time integer (N), from 0 to 255 (8th MSbit to 1st LSbit); otherwise, N = 0. N defines how much the Guard Time that the reader must apply varies from a baseline of 12 ETU (corresponding to 1 start bit, 8 data bits, 1 parity bit, and 2 stop bits; with the second stop bit possibly used for an error indication by the receiver under protocol T = 0).
The Guard Time is the minimum delay between the leading edge of the previous character, and the leading edge of the next character sent.
Except when N is 255, the Guard Time is: GT = 12 ETU + R*N/f
where:
– f is the clock frequency being generated by the reader;
– R is some number of clock cycles, either:
– per ETU, R = F/D, if T = 15 is absent from the ATR;
– defined by TA
1, R = F
i/D
i (or its default value), if T = 15 is present in the ATR.
N = 255 has a protocol-dependent meaning: GT = 12 ETU during PPS (Protocol and Parameters Selection) and protocol T = 0, GT = 11 ETU under protocol T = 1 (corresponding to 1 start bit, 8 data bits, 1 parity bit, and 1 stop bit; with no error indication).
Except under protocol T = 1, the card transmits with a Guard Time of 12 ETU, irrespective of N.
Under protocol T = 1, the Guard Time defined by N is also the Character Guard Time (CGT), and applies to card and reader for characters sent in the same direction.
Note: The reader remains bound by the Guard Time GT defined by N when other prescriptions specify another minimum delay between leading edges of characters in different directions, even when that minimum is lower than GT.
Historical note: ISO/IEC 7816-3:1989 only defined that N code the EGT as a number of ETU, the method now used when T = 15 is absent from the ATR. With this convention, cards that allow negotiation of a reduced number of clock cycles per ETU after PPS must also allow a proportionally reduced number of clock cycles for the EGT, which does not match with a common EGT motivation: account for delays before the card can receive the next character. The 1997 edition of the standard introduced that when T = 15 is present in the ATR, N code the EGT as a multiple of the number of clock cycles per ETU coded by TA1, making the EGT effectively independent of the number of clocks cycles per ETU negotiated, while maintaining compatibility with former readers at least if they did not change the number of clock cycles per ETU.
Interface bytes TD''i''
Interfaces bytes TD
''i'' for ''i''≥1, if present, are structural.
TD
''i'' encodes in its 4 high-order bits the presence of at most 4 other interface bytes: TA
''i''+1 (resp. TB
''i''+1, TC
''i''+1, TD
''i''+1) follow, in that order, if the 5th (resp. 6th, 7th, 8th) bit of TD
''i'' is.
TD
''i'' encodes in its 4 low-order bits (4th MSbit to 1st LSbit) an integer T, in range
..15 T = 15 is invalid in TD
1, and in other TD
''i'' qualifies the following TA
''i''+1 TB
''i''+1, TC
''i''+1, TD
''i''+1 (if present) as global interface bytes. Other values of T indicates a protocol that the card is willing to use, and that TA
''i''+1 TB
''i''+1, TC
''i''+1, TD
''i''+1 (if present) are specific interface bytes applying only to that protocol. T = 0 is a character-oriented protocol. T = 1 is a block-oriented protocol. T in the range
..14is RFU.
Historical note: provision for dynamically qualifying interface bytes as global using T = 15 did not exist in ISO/IEC 7816-3:1989.
Interface byte TA2
Interface byte TA
2, if present, is global, and is named the ''specific mode byte''.
Presence of TA
2 commands that the reader use ''specific mode'' as defined by TA
2 and earlier global bytes, rather than ''negotiable mode'' when TA
2 is absent.
TA
2 encodes in its 4 low-order bits an integer T defining the protocol required by the card, in the convention used for TD
1 (EMV prescribes that a card which T encoded in TA
2 does not match that in TD
1 shall be rejected).
The 5th bit is to encodes that the required ETU duration is F
i/D
i clock cycles as defined by TA
1 (or its default value if absent); or to indicate that the ETU duration is implicitly known (by some convention, or setting of the reader; EMV prescribes that such card shall be rejected).
The 6th and 7th bit are reserved for future use; indicates not used.
The 8th bit is to indicate that the card is unable to change the negotiable/specific mode (that is, does not propose other settings); or to indicate that card has that ability (perhaps after a warm ATR).
Historical note: Provision for specific mode did not exist in ISO/IEC 7816-3:1989. Back then, the interface character TA2 had no particular name or function, and was specific (to the protocol introduced by TD1). ISO/IEC 7816-3:1997 introduced the specific mode and the specific mode byte, with interim note helping cards with specific mode byte TA2 in their ATR dealing with a reader that did not implement specific mode.
Interface byte TB2
TB
2, if present, is global. The usage of TB
2 is deprecated since the 2006 edition of the standard, which prescribes that cards ''should'' not include TB
2 in the ATR, and readers ''shall'' ignore TB
2 if present.
In the 1997 edition of the standard, TB
2 (8th to 1st bit) encode PI2, which when in range 50..250 (other values being RFU) encode V
PP in increments of 0.1 V, and subsumes the coarser indication given by PI1 of TB
1. Refer to that section for why modern Smart Cards have no use of V
PP, and thus of TB
2.
Historical note: Provision for TB2 did not exist in ISO/IEC 7816-3:1989, and was introduced because VPP = 12.5 V became a popular value in EEPROM technology, replacing 25 V and 21 V.
Historical bytes T''i''
Historical Characters T
''i'' for ''i''≥1, if present (as defined by K coded in T0), typically hold Information about the Card Builder, Type of Card (Size etc.), Version number and the State of the Card.
Check byte TCK
The ChecK byte (if present) allows a check of the integrity of the data in the ATR. If present, TCK is the
Exclusive OR
Exclusive or or exclusive disjunction is a logical operation that is true if and only if its arguments differ (one is true, the other is false).
It is symbolized by the prefix operator J and by the infix operators XOR ( or ), EOR, EXOR, , ...
of the bytes in the ATR from T0 (included) to TCK (excluded).
TCK shall be present if and only if any of the TD
''i'' present in the ATR encodes a value of T other than 0.
That rule for TCK presence is per ISO/IEC 7816-3:1989. The later ISO/IEC 7816-3:1997 and ISO/IEC 7816-3:2006 concur, at least whenever TA2 is absent or encodes the same T as TD1 (which is mandated by EMV). Common practice (e.g. in SIM cards) is to apply that rule, notwithstanding the contradictory prescription in EMV 4.3 Book 1, section 8.3.4, that ''The ATR shall not contain TCK if T = 0 only is to be used'', instead reading that prescription as is if it ended in ''if T = 0 only is indicated''.
ATR in synchronous transmission
The official reference defining the ATR in synchronous transmission is the
ISO/IEC 7816-10 standard.
''ISO/IEC 7816-10:1999 — Identification cards — Integrated circuit cards — Part 3: Cards with contacts — Electronic signals and answer to reset for synchronous cards'' (partial preview)
/ref>
The ATR starts with a header of 32 bits organized into 4 bytes, denoted H1 to H4. H1 codes the protocol (with and being invalid), H2 codes parameters of the protocol. Little more is standardized.
References
External links
Smart card ATR parsing
online ATR parsing tool
{{DEFAULTSORT:Answer To Reset
Smart cards