.NET
  Home arrow .NET arrow Page 5 - Smart Cards in .NET
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

Smart Cards in .NET
By: Digvijay Chauhan
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 102
    2004-03-15

    Table of Contents:
  • Smart Cards in .NET
  • The Solution
  • Three More Methods
  • A New Reference
  • The Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Smart Cards in .NET - The Code


    (Page 5 of 5 )

    The ATL COM Component code is self-explanatory, provided you have a fair knowledge of the Microsoft WinSCard.dll API. I’d like to highlight the design I had in my mind.

    There is one class CPCSCReader and three other helper classes CReaderSelDlg, CSCEjectDlg and CSCInsertDlg. These work as shown in diagram below:

    Smart Cards


    The SCardLib COM Component

    The Smart Card related code, which relies heavily in WinSCard.dll, resides in the CPCSCReader and IPCSCReader interface implemenatation. The workhorse of this component is the following WinSCard.dll exported APIs:

    • SCardEstablishContext
    • SCardConnect
    • SCardStatus
    • SCardDisconnect
    • SCardTransmit
    • The code in Helper Classes is mostly UI related.

    At one place in the CReaderSelDlg implementation I needed to find all the available cards, so one WinSCard API (SCardListReaders) has been used there. More details about these API’s can be found in the MSDN.

    Points of Interest

    There are several advantages if you’re using such an approach to access Smart Cards in .NET. The most visible one is isolation from the WinSCard API with the COM wrapper and the type conversion from Win32 types to .NET types.  This is done effectively and precisely by the IDE itself. Any comments and suggestion can be posted to me here.

    People have great ideas and sometimes it’s just the implementation that falters. Maybe now with the help of this library and any code derived from it, excellent smart card enabled applications can be developed. I’ll continue to refine this Library and fix any bugs that are reported to me. Hope this helps you roll out your first Smart Card application soon!

    See you again in the next article in this series where we’ll develop a completely managed wrapper over WinSCard API.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

    .NET ARTICLES

    - Building Applications with Windows Workflow ...
    - Building the Data and Business Layers Using ...
    - The Transformed XML Explorer in MFC
    - List Control and Property Grid with the MFC ...
    - Font, Shell and Masked Edit Controls for MFC
    - Color, Link and Image Editor Controls for M...
    - New Controls for MFC
    - The Windows Ribbon Framework
    - Markup Language for the Ribbon Framework
    - Visually Upgrade Your MFC Project
    - New Features for the Statusbar in MFC
    - Working with the Statusbar in MFC
    - Iron Speed Design v60 Review
    - Binary and XML Serialization
    - Using CrystalReportViewer to Display Crystal...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek