10.2 Command format

The command sequence is as follows:

  1. In compliance with ISO 7816-3, the host must send a header consisting of five characters: CLA, INS, P1, P2 and P3.
    • CLA refers to a class of instructions. This byte is not tested by the device.
    • INS is the instruction byte.
    • P1 and P2 are reference bytes, such as a data byte address or password index.
    • P3 is the number of data bytes transferred during the command. For outgoing transfers (e.g., read commands), P3 = 0 means that 256 data bytes will be emitted by the card. For incoming commands, P3 = 0 means that no data bytes will be transferred.
  2. The device replies with a "procedure byte,” normally equal to the INS code received. If a problem occurs, the device will respond with a status word pair, SW1-SW2, indicating the end of the command.
  3. Data transfer (P3 bytes).
  4. A final SW1-SW2 sequence gives the status of the device after completion of the command. Normal completion is indicated by SW1-SW2 = $90-$00.
    Note: For all bytes transmitted by the device or by the host—including header, procedure, status and data bytes—if a parity error is detected, the receiver requests that the byte be sent again (see character format).