Identification cards - Integrated circuit cards — Part 12: Cards with contacts — USB electrical interface and operating procedures

ISO/IEC 7816-12:2005 specifies the operating conditions of an integrated circuit card that provides a USB interface. An integrated circuit card with a USB interface is named USB-ICC. ISO/IEC 7816-12:2005 specifies the electrical conditions when a USB-ICC is operated by an interface device - for those contact fields that are not used, when the USB interface is applied; the USB standard descriptors and the USB-ICC class specific descriptor; the data transfer between host and USB-ICC using bulk transfers or control transfers; the control transfers which allow two different protocols named version A and version B; the (optional) interrupt transfers to indicate asynchronous events; status and error conditions. ISO/IEC 7816-12:2005 provides two protocols for control transfers. This is to support the protocol T=0 (version A) or to use the transfer on APDU level (version B). ISO/IEC 7816-12:2005 provides the state diagrams for the USB-ICC for each of the transfers (bulk transfers, control transfers version A and version B). Examples of possible sequences which the USB-ICC must be able to handle are given in an informative annex.

Cartes d'identification — Cartes à circuit intégré — Partie 12: Cartes à contacts — Interface électrique USB et procédures de fonctionnement

General Information

Status
Published
Publication Date
03-Oct-2005
Current Stage
9093 - International Standard confirmed
Start Date
19-Mar-2024
Completion Date
30-Oct-2025
Ref Project
Standard
ISO/IEC 7816-12:2005 - Identification cards - Integrated circuit cards — Part 12: Cards with contacts — USB electrical interface and operating procedures Released:10/4/2005
English language
50 pages
sale 15% off
Preview
sale 15% off
Preview

Standards Content (Sample)


INTERNATIONAL ISO/IEC
STANDARD 7816-12
First edition
2005-10-01
Identification cards — Integrated circuit
cards —
Part 12:
Cards with contacts — USB electrical
interface and operating procedures
Cartes d'identification — Cartes à circuit intégré —
Partie 12: Cartes à contacts — Interface électrique USB et procédures
de fonctionnement
Reference number
©
ISO/IEC 2005
PDF disclaimer
This PDF file may contain embedded typefaces. In accordance with Adobe's licensing policy, this file may be printed or viewed but
shall not be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In
downloading this file, parties accept therein the responsibility of not infringing Adobe's licensing policy. The ISO Central Secretariat
accepts no liability in this area.
Adobe is a trademark of Adobe Systems Incorporated.
Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation
parameters were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In
the unlikely event that a problem relating to it is found, please inform the Central Secretariat at the address given below.

©  ISO/IEC 2005
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means,
electronic or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or
ISO's member body in the country of the requester.
ISO copyright office
Case postale 56 • CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 749 09 47
E-mail copyright@iso.org
Web www.iso.org
Published in Switzerland
ii © ISO/IEC 2005 – All rights reserved

Contents Page
Foreword. iv
Introduction . v
1 Scope. 1
2 Normative references. 2
3 Terms and definitions. 2
3.1 Device. 2
3.2 Terms and definitions used in other specifications.2
4 Abbreviations and notation . 2
5 Electrical characteristics of the contacts. 3
6 USB-ICC operated by an interface device. 3
7 USB Descriptors. 4
7.1 Standard Descriptors. 4
7.1.1 The Standard Device Descriptor . 4
7.1.2 The Standard Configuration Descriptor . 5
7.1.3 The Standard Interface Descriptor. 6
7.1.4 The Standard Endpoint Descriptors . 7
7.2 The Class Specific Descriptor . 8
8 Data transfer between host and USB-ICC .10
8.1 Bulk transfers. 10
8.1.1 Bulk messages. 10
8.1.2 ATR and transmission of data. 13
8.1.3 Status and error conditions. 15
8.2 Control transfers. 16
8.2.1 Version A. 16
8.2.2 Version B. 23
8.3 Interrupt transfers. 29
8.3.1 Virtual insertion/removal event. 29
Annex A (informative) Notation for the state diagrams. 30
Annex B (informative) Scenarios for USB transfers . 31
Annex C (informative) Terms and definitions in the USB specification . 45
Annex D (informative) Class specific descriptor Smart Card device class. 46
Bibliography . 50

© ISO/IEC 2005 – All rights reserved iii

Foreword
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical
Commission) form the specialized system for worldwide standardization. National bodies that are members of
ISO or IEC participate in the development of International Standards through technical committees
established by the respective organization to deal with particular fields of technical activity. ISO and IEC
technical committees collaborate in fields of mutual interest. Other international organizations, governmental
and non-governmental, in liaison with ISO and IEC, also take part in the work. In the field of information
technology, ISO and IEC have established a joint technical committee, ISO/IEC JTC 1.
International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, Part 2.
The main task of the joint technical committee is to prepare International Standards. Draft International
Standards adopted by the joint technical committee are circulated to national bodies for voting. Publication as
an International Standard requires approval by at least 75 % of the national bodies casting a vote.
Attention is drawn to the possibility that some of the elements of this document may be the subject of patent
rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights.
ISO/IEC 7816-12 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology,
Subcommittee SC 17, Cards and personal identification.
ISO/IEC 7816 consists of the following parts, under the general title Identification cards — Integrated circuit
cards:
— Part 1: Cards with contacts — Physical characteristics
— Part 2: Cards with contacts — Dimensions and location of the contacts
— Part 3: Cards with contacts — Electrical interface and transmission protocols
— Part 4: Organization, security and commands for interchange
— Part 5: Registration of application providers
— Part 6: Interindustry data elements for interchange
— Part 7: Interindustry commands for Structured Card Query Language (SCQL)
— Part 8: Commands for security operations
— Part 9: Commands for card management
— Part 10: Cards with contacts — Electronic signals and answer to reset for synchronous cards
— Part 11: Personal verification through biometric methods
— Part 12: Cards with contacts — USB electrical interface and operating procedures
— Part 15: Cryptographic information application
[2] [3] [4]
ISO/IEC 10536 specifies access by close coupling. ISO/IEC 14443 and 15693 specify access by radio
frequency. Such cards are also known as contactless cards.
iv © ISO/IEC 2005 – All rights reserved

Introduction
ISO/IEC 7816 is a series of documents specifying integrated circuit cards and the use of such cards for
interchange. These cards are identification cards intended for information exchange negotiated between the
outside world and the integrated circuit in the card. As a result of an information exchange, the card delivers
information (computation result, stored data), and / or modifies its content (data storage, event memorization).
 Five parts are specific to cards with galvanic contacts and three of them specify electrical interfaces.
• ISO/IEC 7816-1 specifies physical characteristics for cards with contacts.
• ISO/IEC 7816-2 specifies dimensions and location of the contacts.
• ISO/IEC 7816-3 specifies electrical interface and transmission protocols for asynchronous cards.
• ISO/IEC 7816-10 specifies electrical interface and answer to reset for synchronous cards.
• ISO/IEC 7816-12 specifies electrical interface and operating procedures for USB cards.
 All the other parts are independent from the physical interface technology. They apply to cards accessed
by contacts and / or by radio frequency.
• ISO/IEC 7816-4 specifies organization, security and commands for interchange.
• ISO/IEC 7816-5 specifies registration of application providers.
• ISO/IEC 7816-6 specifies interindustry data elements for interchange.
• ISO/IEC 7816-7 specifies commands for structured card query language.
• ISO/IEC 7816-8 specifies commands for security operations.
• ISO/IEC 7816-9 specifies commands for card management.
• ISO/IEC 7816-11 specifies personal verification through biometric methods.
• ISO/IEC 7816-15 specifies cryptographic information application.
The International Organization for Standardization (ISO) and International Electrotechnical Commission (IEC)
draw attention to the fact that it is claimed that compliance with this document may involve the use of the
following patents:
WO 00/16255, Data transmission method and card therefor, 23 March 2000
Declared for ISO/IEC 7816-2
WO 01/69881, A method of communication between a smart card and a host station, 20 September 2001
WO 01/57684 A1, Conveying protocol units for portable electronic objects via a protocol for microcomputer
peripherals, 9 August 2001
0001399 / France, Transport d'unités de protocole d'objet électronique portable par protocole pour
péripheriques de micro-ordinateur
09/775668 / USA, Conveying protocol units for portable electronic objects via a protocol for microcomputer
peripherals
© ISO/IEC 2005 – All rights reserved v

1904043 / Europe, Transport d'unités de protocole d'objet électronique portable par protocole pour
péripheriques de micro-ordinateur
1804474 / China, Conveying protocol units for portable electronic objects via a protocol for microcomputer
peripherals
PCT / FR01 / 00326, Transport d'unités de protocole d'objet électronique portable par protocole pour
péripheriques de micro-ordinateur
US 6148354, Architecture for a universal serial bus-based PC flash disk
US 6763399, USB key apparatus for interacting with a USB host via a USB port
ISO and IEC take no position concerning the evidence, validity and scope of these patent rights.
The holders of these patent rights have assured the ISO and IEC that they are willing to negotiate licences
under reasonable and non-discriminatory terms and conditions with applicants throughout the world. In this
respect, the statements of the holders of these patent rights are registered with the ISO and IEC. Information
may be obtained from:
Contact Patent number
Schlumberger Systèmes, France WO 00/16255
WO 01/69881
GEMPLUS, France WO 01/57684 A1
0001399 / France / Granted
09/775668 / USA / Pending
1904043 / Europe / Pending
1804474 / China / Pending
PCT / FR01 / 00326 / Pending
M-Systems, Israel US 6148354
Aladdin Knowledge Systems, USA US 6763399
Infineon Technologies has not identified any patents but confirms that it is prepared to license its patents, both
granted and pending, which may be deemed necessary to manufacture, use, and sell implementations of
ISO/IEC 7816-12 on reasonable and non-discretionary terms and conditions.
The following companies may hold patents relating to this part of ISO/IEC 7816 but have not provided details
of the patents or agreed to provide licenses:
Orga Kartensysteme GmbH, Germany AU 752627
Renesas, Japan US 20050052924
US 20040070952
ST Microelectronics US 6769622
WO 02/317161
Attention is drawn to the possibility that some elements of the document may be the subject of patent rights
other than those identified above. ISO and IEC shall not be held responsible for identifying any or all such
patent rights.
vi © ISO/IEC 2005 – All rights reserved

INTERNATIONAL STANDARD ISO/IEC 7816-12:2005(E)

Identification cards — Integrated circuit cards —
Part 12:
Cards with contacts — USB electrical interface and operating
procedures
1 Scope
This part of ISO/IEC 7816 specifies the operating conditions of an integrated circuit card that provides a USB
interface. Figure 1 shows the assignment of the contact fields for a USB interface and – to illustrate
interoperability – the assignment as used in ISO/IEC 7816-3.

Figure 1 — Assignment of contacts for a USB integrated circuit card

© ISO/IEC 2005 – All rights reserved 1

2 Normative references
The following referenced documents are indispensable for the application of this document. For dated
references, only the edition cited applies. For undated references, the latest edition of the referenced
document (including any amendments) applies.
ISO/IEC 7816-2:1999/Amd.1:2004, Identification cards — Integrated circuit cards — Part 2: Cards with
contacts — Dimensions and location of the contacts — Amendment 1: Assignment of contacts C4 and C8
ISO/IEC 7816-3, Identification cards — Integrated circuit cards — Part 3: Cards with contacts — Electrical
interface and transmission protocols
Universal Serial Bus Specification Revision 2.0, April 27, 2000
USB Implementers Forum
Available at
Universal Serial Bus, Device Class Specification for
USB Chip/Smart Card Interface Devices , Revision 1.00, March 20, 2001
USB Implementers Forum, Device Working Group: Smart Card
Available at
3 Terms and definitions
For the purposes of this document, the following terms and definitions apply.
3.1 Device
3.1.1
interface device
terminal communication device or machine to which the card is electrically connected during operation
[ISO/IEC 7816-3]
3.1.2
USB connection device
device providing an electrical connection path between a USB-ICC and a USB host or hub
3.2 Terms and definitions used in other specifications
For the purposes of this document, the terms and definitions given in the USB specification and the CCID
specification (see Clause 4) apply.
NOTE The relevant terms used in this document are listed in informative Annexes C and D.
4 Abbreviations and notation
For the purposes of this document, the following abbreviations apply.
Protocol T=0, Protocol T=1 [ISO/IEC 7816-3]
D+, D- [Universal Serial Bus Specification Revision 2.0]
USB specification
Referencing to Universal Serial Bus Specification Revision 2.0 (see clause 2).
CCID
Chip Card Interface Device. Designates an interface device controlled via USB.
2 © ISO/IEC 2005 – All rights reserved

CCID specification
Reference to the Device Class Specification for USB Chip/Smart Card Interface Devices (see clause 2).
USB-ICC
USB Integrated Circuit Card. An integrated circuit card providing a USB interface.
5 Electrical characteristics of the contacts
The assignment of the contacts for USB operating conditions is given in ISO/IEC 7816-2:1999 and
ISO/IEC 7816-2:1999/Amd.1:2004.
An interface device will provide a USB connection to a USB-ICC through VCC, GND, AUX1 and AUX2
respectively VBUS, GND, D+ and D- defined by the USB specification.
Cards designed for ISO/IEC 7816-3 operating conditions shall not be damaged when activated under USB
conditions. Conversely, cards designed for USB operation shall not be damaged when activated under
ISO/IEC 7816-3 operating conditions (by definition, a damaged card no longer operates as specified or
contains corrupt data).
6 USB-ICC operated by an interface device
A USB-ICC that only provides a USB interface shall have electrically connected C1, C5, C4 and C8. All other
contact fields shall be electrically isolated. This type of USB-ICC can be operated by a USB connection device.
The USB connection device shall establish an electrical connection to C1, C5, C4 and C8 only, following the
electrical characteristics and protocol given in the USB specification.
An interface device that does not support a USB interface shall have AUX1 and AUX2 electrically isolated or
ensure that the voltage applied at these contact fields shall remain between –0,3V and Vcc + 0,3V.

© ISO/IEC 2005 – All rights reserved 3

7 USB Descriptors
7.1 Standard Descriptors
The standard descriptors described in the USB specification constitute a way for the host software to identify a
new USB device attached, and to load one or more appropriate drivers for this new USB device. The standard
descriptors are read by the host software during the enumeration process. In addition, the descriptors can also
be retrieved by the host software using standard USB requests.
NOTE This document uses for hexadecimal values the notation xxh as used in the USB specification. This is different
from the notation 'xx' which is used in other parts of this standard series. The notation xxh is used here to
avoid possible confusion when reading this document and the related USB documents.
In the following tables of standard descriptors the character asteriks (*) in the column Value indicates that this
value(s) is defined by ISO/IEC, taken from the set of possible values given in the USB specification. All other
values are standard USB entries.
The transmission direction from the host to the USB-ICC is designated as OUT. The transmission direction
from the USB-ICC to the host is designated as IN.
7.1.1 The Standard Device Descriptor
Table 1 — Standard device descriptor for a USB-ICC
Offset Field Size Value Description
0 bLength 1 12h Size of this descriptor in bytes.
1 bDescriptorType 1 01h DEVICE Descriptor Type.
2 bcdUSB 2 0200h USB Specification Release Number.
4 bDeviceClass 1 00h* Indicates that the device class is specified in the
interface descriptor of the device.
5 bDeviceSubClass 1 00h Reset to zero as bDeviceClass is reset to zero.
6 bDeviceProtocol 1 00h* The device does not use class-specific protocols on
the device basis. Instead, it uses class-specific
protocols on the interface level.
7 bMaxPacketSize0 1 Maximum packet size for endpoint zero. The size may
be 8,16,32,64.
For low speed functions the value shall be 8.
8 idVendor 2 Vendor ID, (assigned by the USB-IF).
10 idProduct 2 Product ID, (assigned by the manufacturer).
Definition of the value of this field is out of the scope of this
document.
12 bcdDevice 2 Device release number in binary coded decimal.
Definition of the value of this field is out of the scope of this
document.
14 iManufacturer 1 Index of string descriptor describing manufacturer.
Definition of the content of this string is out of the scope of
this document.
15 iProduct 1 Index of string descriptor describing the product.
Definition of the content of this string is out of the scope of
this document.
16 iSerialNumber 1 Index of string descriptor describing the devices serial
number.
17 bNumConfigurations 1 Number of possible configurations.
4 © ISO/IEC 2005 – All rights reserved

7.1.2 The Standard Configuration Descriptor
Table 2 — Standard configuration descriptor for a USB-ICC
Offset Field Size Value Description
0 bLength 1 09h Size of this descriptor in bytes.
1 bDescriptorType 1 02h CONFIGURATION Descriptor Type.
2 wTotalLength 2 Total length of data returned for this configuration.
includes the combined length of all descriptors
(configuration, interface, endpoint, and class-specific)
returned by this configuration.
4 bNumInterfaces 1 The number of interfaces supported by this
configuration.
5 bConfigurationValue 1 Value to use as an argument to the SetConfiguration()
request to select this configuration.
This value shall be non-zero.
6 iConfiguration 1 Index of string descriptor describing this configuration.
Definition of the content of this string is out of the scope of
this document.
7 bmAttributes 1 Configuration characteristics for the USB-ICC:
Bit 4…0: Reserved (reset to zero)
Bit 5 Remote Wakeup
Bit 6. Self-powered
Bit 7 Reserved (set to one)
For a bus-powered USB-ICC that does not support
remote wake-up, bmAttributes shall have the value
80h
8 MaxPower 1 Maximum power consumption of the USB-ICC from
the bus when the device is fully operational.
Expressed in 2mA units.
© ISO/IEC 2005 – All rights reserved 5

7.1.3 The Standard Interface Descriptor
Table 3 — Standard interface descriptor for a USB-ICC
Offset Field Size Value Description
0 bLength 1 09h Size of this descriptor in bytes.
1 bDescriptorType 1 04h INTERFACE Descriptor Type.
2 bInterfaceNumber 1 Number of the interface. Zero-based value identifying
the index in the array of concurrent interfaces
supported by this configuration.
3 bAlternateSetting 1 00h* Value used to select alternate setting for the interface
identified in the prior field.
Alternate settings are not supported.
4 bNumEndpoints 1 00h* Number of endpoints for a USB-ICC used by this
interface (excluding endpoint zero).
01h*
00h  does not use further endpoints
02h*
01h  uses interrupt-IN
03h*
02h  uses bulk-IN and bulk-OUT
03h  uses bulk-IN, bulk-OUT and interrupt-IN
NOTE 01h indicates that the control endpoints are
used for data transmission and interrupt-IN for notification
of card specific events sent from the USB-ICC to the host.
5 bInterfaceClass 1 0Bh Class code for the Smart Card device class (0Bh) or
the interface class is vendor specific (FFh).
FFh
NOTE A product not using a class specific driver can
be ISO 7816-12 compliant. In this case, the driver will be
chosen using the information given by the vendor, the
manufacturer and the product ID (see Table 1).
6 bInterfaceSubClass 1 00h Subclass code.
7 bInterfaceProtocol 1 00h Protocol code.
01h The Smart Card device class offers the following
interface protocols for a USB-ICC:
02h
- 00h USB-ICC messages using bulk (optional
interrupt)
- 01h USB-ICC specific requests using control
transfer Version A (no interrupt)
- 02h USB-ICC specific requests using control
transfer Version B (optional interrupt)
The given value indicates the transfer mode which is used
for the communication between host and USB-ICC
8 iInterface 1 Index of string descriptor describing this interface.
Definition of the content of this string is out of the scope of
this document.
6 © ISO/IEC 2005 – All rights reserved

7.1.4 The Standard Endpoint Descriptors
A USB-ICC may either communicate with the host using the default control pipe only or it may communicate
over message pipes using bulk-IN and bulk-OUT. Optionally, a USB-ICC may provide an interrupt-IN endpoint
which allows the USB-ICC to indicate specific events to the host. A USB-ICC may have one of the following
configurations:
Table 4 — Configuration of endpoints for a USB-ICC
Endpoints for data Using control transfers Using bulk transfers
transmission
Version A Version B
Default control pipe yes yes yes
Bulk-IN no no yes
Bulk-OUT no no yes
Interrupt-IN no optional optional

The following tables describe the endpoint descriptors:
Table 5 — Endpoint descriptor bulk-OUT
Offset Field Size Value Description
0 bLength 1 07h Size of this descriptor in bytes.
1 bDescriptorType 1 05h ENDPOINT descriptor type.
2 bEndpointAddress 1 01-0Fh The address of this endpoint on the USB-ICC. This
address is an endpoint number between 1 and 15.
Bit 3…0 Endpoint number
Bit 6…4 Reserved, must be 0
Bit 7 0 = OUT
3 bmAttributes 1 02h This is a bulk endpoint.
4 wMaxPacketSize 2 00xxh Maximum data transfer size. May be 8, 16, 32, 64.
6 bInterval 1 00h Does not apply to bulk endpoints.

Table 6 — Endpoint descriptor bulk-IN
Offset Field Size Value Description
0 bLength 1 07h Size of this descriptor in bytes.
1 bDescriptorType 1 05h ENDPOINT descriptor type.
2 bEndpointAddress 1 81-8Fh The address of this endpoint on the USB-ICC. This
address is an endpoint number between 1 and 15.
Bit 3…0 Endpoint number
Bit 6…4 Reserved, must be 0
Bit 7 1 = IN
3 bmAttributes 1 02h This is a bulk endpoint.
4 wMaxPacketSize 2 00xxh Maximum data transfer size. May be 8, 16, 32, 64.
6 bInterval 1 00h Does not apply to bulk endpoints.
© ISO/IEC 2005 – All rights reserved 7

Table 7 — Endpoint descriptor interrupt-IN
Offset Field Size Value Description
0 bLength 1 07h Size of this descriptor in bytes.
1 bDescriptorType 1 05h ENDPOINT descriptor type.
2 bEndpointAddress 1 81-8Fh The address of this endpoint on the USB-ICC. This
address is an endpoint number between 1 and 15.
It shall be different from the bulk-IN endpoint address.
Bit 3…0 Endpoint number
Bit 6…4 Reserved, must be 0
Bit 7 1 = IN
3 bmAttributes 1 03h This is an interrupt endpoint.
4 wMaxPacketSize 2 00xyh Packet size for USB-ICC. The minimum value shall be
02h.
6 bInterval 1 xyh Interval for polling endpoint data transfers. Expressed in
milliseconds. The value shall be in the range from 1 to 255.
In order to save bandwidth, the recommended value is
255.
7.2 The Class Specific Descriptor
The Smart Card device class uses the class specific descriptor as described in the CCID specification (see
Annex D (informative)). In the context of a chip card interface device, a USB-ICC represents a configuration of
a single slot interface device with a permanently inserted card. The possible values for the class specific
descriptor reflect this device configuration. Fields containing bReserved or dwReserved signify parameters
that are not relevant for a USB-ICC. Although not relevant, it is mandatory that a USB-ICC uses exactly these
values for bReserved and dwReserved in order to maintain compatibility with the CCID specification.
Table 8 — Class specific descriptor for a USB-ICC
Offset Field Size Value Description
0 bLength 1 36h Size of this descriptor, in bytes.
1 bDescriptorType 1 21h CCID Functional Descriptor type.
2 bcdCCID 2 CCID Specification Release Number in binary
coded decimal. The current version 1.0 is 0100h.
CCID Specification Release Number 1.0 will be
updated by the USB-DWG Smart Card.
4 bMaxSlotIndex 1 00h Index of the highest available slot. A USB-ICC is
regarded as single slot.
5 bReserved 1 01h This value shall be 01h.
6 dwProtocols 4 0000 Indicates the supported protocol types:
0001h
00000001h = Protocol T=0
0000 00000002h = Protocol T=1
0002h
NOTE The USB-ICC supports APDU level
exchanges for T=1 or character level exchanges for
T=0. Other combinations of dwProtocols and
dwFeatures are not supported by the USB-ICC. This
applies for bulk transfer mode and for control transfer
mode.
8 © ISO/IEC 2005 – All rights reserved

Offset Field Size Value Description
10 dwReserved 4 0000 This value shall be 0000 0DFCh.
0DFCh
14 dwReserved 4 0000 This value shall be 0000 0DFCh.
0DFCh
18 bReserved 1 00h This value shall be 00h.
19 dwReserved 4 0000 This value shall be 0000 2580h.
2580h
23 dwReserved 4 0000 This value shall be 0000 2580h.
2580h
27 bReserved 1 00h This value shall be 00h.
28 dwMaxIFSD 4 Indicates the maximum IFSD supported by the
USB-ICC for protocol T=1. For T=0 any value
may be given.
For T=1: 000000FEh
For T=0: any value
32 dwReserved 4 0000 This value shall be 0000 0000h
0000h
36 dwMechanical 4 0000 Indicates that a USB-ICC has no special
0000h characteristics.
40 dwFeatures 4 0000 The value of the lower word (=0840) indicates
0840h that the host will only send requests that are valid
for the USB-ICC.
0002 The value of the upper word is the level of data
0840h exchange with the USB-ICC:
0004 0000h Character level exchanges
0840h 0002h Short APDU level exchanges
0004h Short and extended APDU level
exchanges
NOTE see also dwProtocols
44 dwMaxCCIDMessageLength 4 For bulk transfers, the value shall be between:
261 + 10 and 65544 +10.
NOTE The value 10 is the size of the header
For control transfers, the vlue shall be between:
261 and 65544.
48 bReserved 1 FFh This value shall be FFh.
49 bReserved 1 FFh This value shall be FFh.
50 wRFU 2 0000h All other values are reserved for future use
52 bRFU 1 00h All other values are reserved for future use.
53 bMaxCCIDBusySlots 1 01h The USB-ICC is regarded as a single slot.

© ISO/IEC 2005 – All rights reserved 9

8 Data transfer between host and USB-ICC
The exchange of data between host and USB-ICC may be done using bulk transfers or control transfers. For
control transfer, two implementations are possible. They are named Version A and Version B. Bulk transfer
mode is compliant to the CCID specification, e.g. it uses a subset of the messages/requests as defined in this
specification.
The notation for the state diagrams is given in the (informative) Annex A.
8.1 Bulk transfers
To transmit commands, responses and corresponding data between host and USB-ICC, the following
messages shall apply:
Table 9 — Bulk-IN and bulk-OUT messages
Bulk-OUT message name Bulk-IN response message name Description
PC_to_RDR_IccPowerOn RDR_to_PC_DataBlock Exits the initial state of a USB-ICC and
returns the ATR in the response
message.
PC_to_RDR_IccPowerOff RDR_to_PC_SlotStatus Sets the USB-ICC to initial conditions.
PC_to_RDR_XfrBlock RDR_to_PC_DataBlock Messages to transmit data between
host and USB-ICC.
8.1.1 Bulk messages
All messages transmitted over bulk endpoints start with a 10 byte header, optionally followed by data.
The purpose of the header is to exchange control and status information between host and USB-ICC. In
addition, sequence numbering assigns command messages with their corresponding response messages.
The USB-ICC returns its status and error information in the fields bStatus and bError.
8.1.1.1 PC_to_RDR_IccPowerOn and RDR_to_PC_DataBlock
Table 10 — PC_to_RDR_IccPowerOn message
Offset Field Size Value Description
0 bMessageType 1 62h Indicates PC_to_RDR_IccPowerOn.
1 dwLength 4 00000000h There are no extra bytes of this message.
5 bSlot 1 00h Slot number for the USB-ICC.
6 bSeq 1 00h – FFh Sequence number for the command.
7 bReserved 1 01h This value shall be 01h.
8 abRFU 2 0000h All other values are reserved for future use.

The response to this message is the RDR_to_PC_DataBlock message.

10 © ISO/IEC 2005 – All rights reserved

Table 11 — RDR_to_PC_DataBlock message containing the ATR
Offset Field Size Value Description
0 bMessageType 1 80h Indicates RDR_to_PC_DataBlock.
1 dwLength 4 Size of bytes for the ATR.
5 bSlot 1 00h Slot number for a USB-ICC.
6 bSeq 1 Same value as Sequence number for the corresponding command
corresponding message.
bulk-OUT
message
7 bStatus 1 USB-ICC status information.
8 bError 1 Error code in case of failure.
9 bChainParameter 1 00h Indicates that this message contains the complete
ATR.
10 abData  ATR.
8.1.1.2 PC_to_RDR_IccPowerOff and RDR_to_PC_SlotStatus
Table 12 — PC_to_RDR_IccPowerOff message
Offset Field Size Value Description
0 bMessageType 1 63h Indicates PC_to_RDR_IccPowerOff.
1 dwLength 4 00000000h There are no extra bytes of this message.
5 bSlot 1 00h Slot number for a USB-ICC.
6 bSeq 1 00h – FFh Sequence number for command.
7 abRFU 3 000000h All other values are reserved for future use.

The response to this message is the RDR_to_PC_SlotStatus message.
Table 13 — RDR_to_PC_SlotStatus message
Offset Field Size Value Description
0 bMessageType 1 81h Indicates RDR_to_PC_SlotStatus.
1 dwLength 4 00000000h There are no extra bytes of this message.
5 bSlot 1 00h Slot number for a USB-ICC.
6 bSeq 1 Same value as Sequence number for the corresponding
corresponding command message.
bulk-OUT
message
7 bStatus 1 USB-ICC status information.
8 bError 1 Error code in case of failure.
9 bReserved 1 00h This value shall be 00h

© ISO/IEC 2005 – All rights reserved 11

8.1.1.3 PC_to_RDR_XfrBlock and RDR_to_PC_DataBlock
The PC_to_RDR_XfrBlock command is used to transmit command APDUs.
Table 14 — PC_to_RDR_XfrBlock message
Offset Field Size Value Description
0 bMessageType 1 6Fh Indicates PC_to_RDR_XfrBlock message.
1 dwLength 4 Size of abData field of this message.
5 bSlot 1 00h Slot number for a USB-ICC.
6 bSeq 1 00h – FFh Sequence number for command.
7 bReserved 1 00h Shall be set to 00h
8 wLevelParameter 2 Depends on the exchange level reported by the
class specific descriptor in the dwFeatures field:
- Character level:
size of expected data to be returned by the
bulk-IN endpoint,
- Short APDU level: 00h
- Extended APDU level:
Indicates if APDU begins or ends in this
command:
0000h: the command APDU begins and
ends with this command,
0001h: the command APDU begins with
this command, and continues in
next PC_to_RDR_XfrBlock,
0002h: this abData field continues a
command APDU and ends the
command APDU,
0003h: the abData field continues a
command APDU and another
block is to follow,
0010h: empty abData field, continuation
of response APDU is expected
in the next RDR_to_PC_DataBlock
10 abData  Data block sent from host to the USB-ICC.

The response to this message is the RDR_to_PC_DataBlock message.

Table 15 — RDR_to_PC_DataBlock message containing a data block
Offset Field Size Value Description
0 bMessageType 1 80h Indicates RDR_to_PC_DataBlock.
1 dwLength 4 Size of bytes for the received data block.
5 bSlot 1 00h Slot number for a USB-ICC.
6 bSeq 1 Same value as Sequence number for the corresponding
bulk-OUT command message.
message
12 © ISO/IEC 2005 – All rights reserved

Offset Field Size Value Description
7 bStatus 1 USB-ICC status information.
8 bError 1 Error code in case of failure.
9 bChainParameter 1 Depends on the exchange level reported by the
class specific descriptor in the dwFeatures field:
- Character level: 00h
- Short APDU: 00h
- Extended APDU level:
Indicates if the response is complete, to be
continued or if the command APDU can
continue:
00h: the response APDU begins and
ends in this command,
01h: the response APDU begins with
this command and is to continue,
02h: this abData field continues the
response APDU and ends the
response APDU,
03h: this abData field continues the
response APDU and another block
is to follow,
10h: empty abData field, continuation of
the command APDU is expected in
the next PC_to_RDR_XfrBlock
command.
10 abData  Data sent from USB-ICC to the host.

8.1.2 ATR and transmission of data
When a USB device is attached to the bus and thereafter has obtained a state where the host may use the
functions provided by the device, the device is designated as "Configured". The messages to be transmitted in
order to set the USB-ICC to initial state, to obtain the ATR and to transmit data are given in the state diagram
Figure 2. The transmission uses APDU level exchanges. Figure 2 comprises the transmission of short APDUs
and extended APDUs.
For the correct transmission of data, the following general rules shall apply:
 If the USB-ICC receives a PC_to_RDR_PowerOn when it is not in the state "Initial", the USB-ICC shall
respond with a STALL. The USB-ICC shall remain in its current state.
 If the USB-ICC requests a time extention (see Table 16), the value of bSeq (see clause 8.1.1) shall
remain unchanged.
 If the USB-ICC returns RDR_to_PC_DataBlock indicating the errors ICC_MUTE or HW_ERROR, the host
should preferably submit a PC_to_RDR_IccPowerOff message.
IMPORTANT — The state of the current execution shall not be affected by the state of the USB
interface engine. For example, a bus enumeration shall not cause any transitions.
© ISO/IEC 2005 – All rights reserved 13

USB-ICC is
USB-ICC is
configured virtually not present
Busy[i]
Initial Any State
Waiting Time
PC_to_RDR_IccPowerOff
USB-ICC is Overrun detected
exeeded
abData: empty
PC_to_RDR_IccPowerOn
present
abData: empty
RDR_to_PC_DataBlock
RDR_to_PC_DataBlock RDR_to_PC_SlotStatus
bmIccStatus: 0
bmIccStatus: 0
bmIccStatus : 2
bmCommandStatus: 1
bmCommandStatus: 2
bmCommandStatus: 0
bError: XFR_OVERRUN
bSeq: remains unchanged abData:: empty
Busy1
abData: empty
abData: empty
End of Process Waiting for
command Initial
APDU
RDR_to_PC_DataBlock
bChainParameter: 00h
abData: ATR
USB-ICC is
activated
Waiting for
command
APDU
PC_to_RDR_XfrBlock PC_to_RDR_XfrBlock RDR_to_PC_DataBlock RDR_to_PC_DataBlock
wLevelParameter: 0001h wLevelParameter: 0000h bChainParameter: 00h bChainParameter: 02h
abData: command APDU abData: response APDU abData: last part of response APDU
abData: part of command APDU
no
Chained
Busy2
response
APDU?
Busy4
yes
End of Process
End of Process
RDR_to_PC_DataBlock
bChainParameter: 01h
RDR_to_PC_DataBlock
abData: part of response APDU
bChainParameter: 10h
abData: empty
Response
Command
APDU
APDU
partially sent
partially
received
yes
PC_to_RDR_XfrBlock
PC_to_RDR_XfrBlock PC_to_RDR_XfrBlock
wLevelParameter = 0010h
wLevelParameter: 0003h wLevelParameter: 0002h
abData: empty
abData: last part of command APDU
abData: part of command APDU
Busy5
Busy3
End of Process
End of Process
Last part of
RDR_to_PC_DataBlock
RDR_to_PC_DataBlock
bChainParameter: 03h response
bChainParameter: 10h
APDU?
abData: part of response APDU
abData: empty
no
dwFeatures: 0002 0840h (short APDU) and
0004 0840h (extended APDU)
dwProtocol: 0000 0002h (T=1)
Figure 2 — State diagram of the USB-ICC using bulk transfer
APDU level transfer for short APDU and extended APDU

14 © ISO/IEC 2005 – All rights reserved

8.1.3 Status and error conditions
The bulk-IN messages RDR_to_PC_SlotStatus and RDR_to_PC_DataBlock contain status information about
the USB-ICC and if the processed commands completed successfully. In case of a failure, an error code will
be returned.
The bStatus field consists of two bitmap fields that contain information about the USB-ICC status
(bmICCStatus) and the processed command (bmCommandStatus). The following two tables give the values
for the status and the error codes.
Table 16 — Bitmap for bStatus field
Offset Field Size Value Description
0 bmIccStatus 1 0, 1, 2 0 = The USB-ICC is present and activated.
1 = The USB-ICC is present but not activated
(2 bits)
2 = The USB-ICC is virtually not present
3 = RFU
(2 bits) (4 bits) RFU
(6 bits) bmCommandStatus (2 bits) 0, 1, 2 0 = Processed without error.
1 = Failed, error condition given by bError.
2 = Time extention is requested
3 = RFU
1 bError 1 Error codes
Table 17 — Error codes for bError
Error name Error code Possible causes
ICC_MUTE -2 (FEh) The applications of the USB-ICC did not respond or the ATR could
not be sent by the USB-ICC.
XFR_OVERRUN -4 (FCh) The USB-ICC detected a buffer overflow when receiving a data
block.
HW_ERROR -5 (FBh) The USB-ICC detected an hardware error.
-64 to –127 User defined
(C0h – 81h)
-3 (FDh) These values shall not be used by the USB-ICC
-8 to –14
(F8h –F2h)
-16 (F0h)
-17 (EFh)
-32 (E0h)
all others Reserved for future use
(80h and those
filling the gaps)
© ISO/IEC 2005 – All rights reserved 15

For the usage of error codes, the following rules shall apply:
 if the value of bmCommandStatus equals 0 or RFU, the value of bError shall be 0.
 if the value of bmCommandStatus equals 1, the value of bError shall be:
 error code = error conditions as described in Table 17.
 offset = if the USB-ICC can not parse one field in the (10 byte) header or is not supporting one
of these fields, then bError contains the offset of the first bad value as a positive
number (e.g. if the host sets bSlot to 01h, the USB-ICC will return bError = 05h). A
USB-ICC receiving a command that is not supported, shall set the offset value to
zero.
8.2 Control transfers
This transfer mode can be employed for USB-ICCs that offer low speed functions. The default control pipe is
used to exchange data between host and USB-ICC.
This paragraph defines the class specific requests for control transfer. These requests provide the same
services to the application layer as for bulk transfers.
There are two implementations for control transfers, named hereafter as Version A and Version B.
8.2.1 Version A
8.2.1.1 Specific requests
The following table defines valid values of bRequest:
Table 18 — Class specific requests, Version A
bRequest Value Direction Description
data stage
ICC_POWER_ON 62h IN Exits the initial state of a USB-ICC. Returns the ATR in
the data stage.
ICC_POWER_OFF 63h OUT Sets the USB-ICC to initial conditions.
XFR_BLOCK 65h OUT Data transfer from the host to the USB-ICC
DATA_BLOCK 6Fh IN Data transfer from the USB-ICC to the host
GET_ICC_STATUS A0h IN Returns the status of the command execution.

8.2.1.2 Setup Stage
The setup stage contains the class specific request and corresponding parameters. The following tables give
the values and the parameters for each of the class specific requests and describe the data that is transferred
between host and USB-ICC.
For the parameters, the following general rules shall apply:
 The value of bInterface is the same value as bInterfaceNumber given in Table 3.

...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.

Loading comments...