Home arrow C++ arrow Page 4 - Writing a Smart Card Library

Writing a Smart Card Library

In this article we are going to develop a Smart Card Library that will ease the development of Smart Card Applications using the Win32 SDK and/or MFC. This assumes that youíre familiar with Win32 and MFC. The library builds upon the available support for Smart Cards in Windows by providing an Object Oriented wrapper over the WinSCard API. One advantage of using this library is the layered approach, which isolates the core APIís available to non-Win32 conformant languages like java to access this library through JNI (Java Native Interfaces). If youíve already developed some applications using the APIs exposed by WinSCard.dll then youíll be well aware of the complexities involved and here is an attempt to ease them.

Author Info:
By: Digvijay Chauhan
Rating: 5 stars5 stars5 stars5 stars5 stars / 116
April 26, 2004
  1. · Writing a Smart Card Library
  2. · The Approach
  3. · The CPCSCReader Class
  4. · The CRegListDlg Class
  5. · The Demo Application: SCardDemo

print this article

Writing a Smart Card Library - The CRegListDlg Class
(Page 4 of 5 )

This class just presents a UI (user Interface) to select a reader from the installed readers. The readers displayed in this selection dialog are picked from the registry settings displayed above (Figure 2). For a snapshot of this UI element refer to figure 5.

You can modify the code to display the readers from an entirely different location or even an ini file. It's solely dependent on the requirements one may have. But as Microsoft implements t this way I thought it'd be better if I stick to the registry.

Writing a Smart Card Reader
Figure 5: The CPCSCCommand class and Members

The CPCSCCommand Class

This class encapsulates an APDU object. That is it takes care of the data sent and received from the card. Although I've provided a CString override of  the SendCommandToCard() method but I'd recommend using the CPCSCCommand class.

The members with the prefix m_ are the actual data units that constitute the APDU and the remaining methods just set or retrieve them. The code for this class is straightforward and you can take a look to get a better understanding.

blog comments powered by Disqus

- Intel Threading Building Blocks
- Threading Building Blocks with C++
- Video Memory Programming in Text Mode
- More Tricks to Gain Speed in Programming Con...
- Easy and Efficient Programming for Contests
- Preparing For Programming Contests
- Programming Contests: Why Bother?
- Polymorphism in C++
- Overview of Virtual Functions
- Inheritance in C++
- Extending the Basic Streams in C++
- Using Stringstreams in C++
- Custom Stream Manipulation in C++
- General Stream Manipulation in C++
- Serialize Your Class into Streams in C++

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials