Accessing a Smart Card
A version of this page is also available for
4/8/2010
The smart card subsystem provides several means for an application or a service provider to connect to a smart card. The simplest way to establish communication with a smart card is for an application to call the SCardConnect function to connect to a smart card that resides in a specified reader.
An application can also search for a specific smart card within a specified reader group. The application identifies the card by its friendly name and specifies a list of readers in which the smart card might appear. The resource manager searches the list of readers for any smart cards with an ATR string that matches the named smart card, and returns status information to the application. The smart card subsystem never displays a graphical user interface (GUI) or interacts with the card beyond obtaining the ATR string. It does, however, supply sufficient information for the application or a common control to guide a user through the locating of the desired smart card or type of smart card. This results in mapping the request to a specific reader, to which further I/O is directed.
An application can request a list of smart cards that support a specified set of smart card interfaces. The application then can use the list, which enables applications to connect to smart cards that are based on their capabilities, without regard to their names.
When an application looks for a smart card, the application supplies an array of reader names. For each reader element in the array, the resource manager supplies the following information:
- Whether or not the reader is available for use by this application
- Whether or not there is a card inserted into this reader, and if so, what its ATR string is
- Whether or not the ATR string of the smart card matches any of the ATR strings of the requested smart cards
The application uses the returned information to apply additional filters to the smart cards or to prompt the user to select the desired smart card. Note that one or more of the returned lists of readers can be opened for exclusive use by other applications, so that access to this list of readers is not guaranteed.