Smart Cards in .NET - Three More Methods
(Page 3 of 5 )
The following three methods provide the necessary UI components:
- SelectReader: Presents the user with a dialog that displays the available IFDs connected to the PC and allows selection of one.
- EjectCard: Presents the user with a dialog that notifies the user that the card can be removed safely from the reader.
- InsertCard: Presents the user with a dialog signifying that the reader can receive a card now.
And the following five methods provide the way to easy smart card access:
- OpenReader
- CloseReader
- GetReaderName
- SetReaderName
- SendCommand
I finalized all these UI items and methods after reviewing the PS/SC workgroup (http://www.pcscworkgroup.com) recommendations for implementing such a library. The specification is open and is available for free download at the website.
The COM component is implemented as a DLL and it needs to be registered on the client machine, which can be done by simply running regsvr32.exe <DLL Name> at the command prompt.
Once the component is registered you can use it in a variety of programming languages to access smart Card IFDs which are based on PC/SC specifications. I’m glad that most, if not all of the available Smart Card readers fall under this category. You can find three such usages in the samples accompanying this article. Let’s move on to .NET and smart cards.
Create a Windows Application in C# or VB.NET. Using the Add Reference … | COM Components tab locate the SCardLib 1.0 Type library and add it to your project. The following images will explain to you how to do it.

Next: A New Reference >>
More .NET Articles
More By Digvijay Chauhan