The ISO 7816 Standard
The basis upon which virtually all existing smart cards are based is the standard ISO 7816: Identification Cards - Integrated Circuit(s) Cards with Contacts. This is a multiple-part standard in which smart cards are specified in sufficient detail to achieve a satisfactory level of interoperability. ISO 7816 comprises six approved parts and has several additional parts under review. The first three parts will be briefly discussed in this section. Part four is discussed in chapter 4 (a more detailed version can be found in Appendix A):
- Part 1: Physical characteristics
- Part 2: Dimensions and location of the contacts
- Part 3: Electronic signals and transmission protocols
- Part 4: Inter-industry commands for interchange
- Part 5: Numbering system and registration procedure for application identifiers
- Part 6: Inter-industry data elements
1. Physical Characteristics of Smart Cards (ISO 7816-1)
ISO 7816-1 defines the physical characteristics of the smart card. It includes exposure limits for a number of electromagnetic phenomena such as x-rays, ultraviolet light, electromagnetic fields, static electric fields and the ambient temperature of the card. These limits are shown in the table below:
Phenomenon |
Limit |
Ultraviolet light |
Ambient |
X-rays |
Twice the acceptable annual human dosage |
Electromagnetic interface (EMI) |
No interference with magnetic stripe |
Electromagnetic fields |
Less than 1,000 Oe |
Static electricity |
1,500 volt discharge through 1.5 Kohm resistor from 100 pF capacitor |
Heat dissipation |
Less than 2.5 watt; card temperature less than |
Table 4.1: Exposure limits for physical phenomenon [2].
The specification also defines the characteristics of the card when it is bent or flexed. Two flexibility tests are specified (bending and torsion). The aim of both tests is to determine whether the smart card will be able to withstand normal wear and tear (e.g. keeping the card in a wallet or pocket) without the chip or microconnection wires from the chip to the surface contacts being damaged. In addition, ISO 7816-1 specifies acceptable limits for the electrical resistance of the card’s contacts.
2. Location of Contacts on Smart Cards (ISO 7816-2)
ISO 7816-2 specifies a smart card containing eight electrical contacts in a standardised position on the front face of the card. These contacts are referred to as C1 to C8. Some of these contacts are connected to the integrated circuit chip and others are not - allowing for future enhancements. The specific definition for each contact is shown in the Table 4.2.
Contact |
Designation |
Use |
C1 |
Vcc |
Power connection through which operating power is supplied to the microprocessor chip |
C2
|
RST |
Reset line through which the IFD can signal to the smart card’s microprocessor chip to initiate its reset sequence of instructions |
C3
|
CLK |
Clock line through which a clock signal can be provided to the microprocessor to control the speed at which it operates as well as synchronising data communication between the IFD and smart card |
C4
|
RFU |
Reserved for future use |
C5
|
GND |
Ground line providing a common electrical ground between the IFD and smart card |
C6
|
Vpp |
Programming power connection providing a separate power source that can be used to program the EEPROM on the chip. (No longer used - optional) |
C7
|
I/O |
Input/Output line providing a half-duplex communication channel between the reader and the smart card |
C8
|
RFU |
Reserved for future use |
Table 4.2: Definitions of contacts on a smart card integrated circuit chip.
The location of the contacts is illustrated in Figure 4.1 below:
Figure 4.1: Contacts of a smart card integrated circuit chip [11].
Many of the earliest smart cards adhered to a different standard where the contacts were positioned toward the upper-left part of the front face. Smart cards using this standard were used in Europe to support credit and debit applications. This standard became obsolete in 1990.
3. Smart Card Communications (ISO 7816-3)
ISO 7816: Part 3 defines the electrical signals and transmission protocols. It describes the relationship between the smart card and the reader as one of a master (reader) and a slave (smart card). The reader establishes communication by signaling the smart card through the electrical contacts on the card. The smart card responds accordingly. The communication channel is single-threaded and so once the reader has issued a command to the smart card, it is blocked until a response is received. Figure 4.2 illustrates the communication between the smart card and the reader through a series of state transitions.
Figure 4.2: Reader and smart card state diagrams [2].
3.1 Smart Card Insertion and Activation
Power is not applied to any of the contacts when a card is inserted into the reader. The reason for this is that a card could be seriously damaged if power was applied to the wrong contact. This could easily happen if a card were inserted into powered contacts. Instead an edge detector is used in order for the reader to determine when a card is properly aligned with the contact points. When the reader detects that the card is properly inserted, it applies power to the card. The smart card is powered up according to a well-defined sequence as shown on the timing diagram in Figure 4.3.
Figure 4.3: Timing diagram of smart card power-up sequence.
The contacts are first brought into an idle state. This is characterised as being when the power (Vcc) is set high to a stable operating voltage of 5v. (An initial power setting of 5v is always applied even though some microprocessor chips operate at 3v when in an I/O state.) The I/O contact is set to a reception mode on the reader side and a stable clock (CLK) is applied. The reset line should be in a low state and remain low for at least 40,000 CLK cycles before the reader can initiate a valid reset sequence. The reader then sends a reset signal to the card by setting the reset (RST) line into a high state. This signals the card to begin its initialisation sequence.
Different cards may use varying specific initialisation operations, however they should always result in the sending of an answer to reset (ATR) from the card to the reader. The time constraint on the first byte of the ATR being received by the reader is 40,000 clock cycles. If the ATR is not returned in the prescribed time, the reader begins a sequence to power down the card. In this sequence, the Vcc, RST, CLK and I/O lines are set low. Each successive byte of the ATR must be received by the reader at a minimal rate of 1 byte per second.
3.2 Data Transmission
The I/O line carries a single bit if data per unit of time defined by the CLK whose value depends on its voltage relative to GND. The convention of whether to use +5v for a bit value of 1 or to use 0v is conveyed to the reader through the "initial character" of the ATR, also known as TS. The I/O line is always in the high state prior to the transmission of a character. It takes 10 bits to transfer 1 byte of data across the I/O line: the first bit is always a "start bit" (low state) and the last is a parity bit. The parity for each byte transferred should be even - the total number of bits in the byte whose value is 1 (incl. the parity bit) must be an even number. The following TS character indicates that the card uses an "inverse convention" i.e. H corresponds to a 0 and L corresponds to a 1: (H)LHHLLLLLLH. A TS character of the form (H)LHHLHHHLLH signals that the card uses the "direct convention" where H corresponds to a 1 and L to a 0.
The bit ordering in each byte is also controlled by the convention. In the inverse convention, the first bit following the start bit is the high-order bit of the byte. Whereas in the direct convention, the first bit following the start bit is the low-order bit of the byte. Successively higher order bits follow in sequence.
The communication channel to and from a smart card is half-duplex - data can either flow from the reader to the card or from the card to the reader, but not both at the same time. The significance of this is that the smart card and the reader must be synchronised. If both reader and card transmit at the same time then data will be lost. Moreover, if both are listening then the system will enter a deadlock situation. During the power-up sequence, both the reader and the card enter a receive state in which both are listening on the I/O line. Once the reset operation has completed the card enters a send state (to send the ATR to the reader). After this, both ends of the channel alternate between send and receive states.
The CLK and I/O lines are capable of supporting a wide range of data transmission speeds. The speed used is conveyed from the card to the reader via an optional character in the ATR. The transmission speed is set by establishing a "one bit time" on the I/O line, this means that an interval is established at which the I/O line can be sampled in order to read successive bits. This time is defined as an elementary time unit (etu). The etu during the ATR sequence is always defined to be:
etu = 372/CLK frequency
The CLK frequency is always between 1Mhz and 5Mhz - the frequency selected is generally such that the initial data transfer rate is 9,600 bits per second (bps). A typical smart card chip is capable of transmitting and receiving data at speeds up to 115,200bps. However, the data channel can be noisy and reliable communication is more important than high-speed communication.
3.3 The Answer to Reset Sequence
The ATR is a string of characters returned from the card indicating a successful power-up sequence. The total length of the ATR sequence is limited to 33 bytes and must adhere to the following format:
|
Initial Character Section |
TS |
Mandatory initial character |
|
Format Character Section |
T0 |
Indicator for presence of interface characters |
|
Interface Character Section |
TA1 |
Global, codes F1 and D1 |
TB1 |
Global, codes 11 and Pl1 |
TC1 |
Global, code N |
TD1 |
Codes Y2 and T |
TA2 |
Specific |
TB2 |
Global, code Pl2 |
TC2 |
Specific |
TD2 |
Codes Y3 and T |
TA3 |
TAi, TBi and TCi are specific |
...TDi |
Codes Yi+1 and T |
|
Historical Character Section |
T1 |
Card specific information |
...TK |
(Maximum of 15 characters) |
|
Check Character Section |
TCK2 |
Optional check character |
|
Table 4.3: The Answer-To-Reset structure [2].
TS and T0 are the only mandatory bytes in the ATR sequence. As previously described, the initial character TS is used to establish bit-signaling and bit-ordering conventions. T0 is used to indicate the presence or absence of subsequent interface or historical characters. The upper 4 bits (bits 5 - are designated Y1 and signals the presence of optional characters based on a logic 1 in the following bit positions:
- Bit 5 indicates TA1 is present
- Bit 6 indicates TB1 is present
- Bit 7 indicates TC1 is present
- Bit 8 indicates TD1 is present
The lower 4 bits (bits 1 - 4) are designated K and is interpreted as a numeric value in the range 0 - 15. It indicates the number of historical characters present.
The interface characters are used to select the protocol used for subsequent higher-level communication between the smart card and the reader. ISO 7816-3 defines two protocols: the T=0 protocol and the T=1 protocol. T=0 is an asynchronous character-oriented protocol where an acknowledgement must be received for every byte that is sent. In contrast, T=1 is an asynchronous block-oriented protocol where a number of bytes can be sent before an acknowledgement must be received [12]. Both the T=0 and T=1 protocols are described in more detail in the next chapter (Chapter 5).
The historical characters are usually used to indicate the type, model and use of the specific card. These are generally defined by the manufacturer or card issuer. There is no established standard for the data in these historical bits. The check character (TCK) used to determine whether a transmission error occurred in sending the ATR from the card to the reader. TCK is a checksum calculated such that performing a bit-wise exclusive-or (XOR) operation on all bytes in the ATR from T0 to TCK results in an answer of zero.
3.4 Protocol Negotiation
The ATR sequence is responsible for initialising the physical communication channel between the reader and the smart card. It facilitates the definition and manipulation of a number of characteristics of the channel. ISO 7816-3 also specifies a more elaborate method of selecting a protocol known as the Protocol Type Selection (PTS) facility. The reader can negotiate with the card to obtain an optimum set of characteristics for the channel through the PTS. However, optimum communication characteristics are usually achieved through the ATR sequence without performing a PTS sequence. For this reason, this report will not discuss the PTS in any further detail.