Kefei Virtual Software PCSC Smartcard Reader<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Introduction:
Virtual SmartCard Reader provides us with a software SmartCard Reader interface, which can bridge the PC terminal application and smartcard application.
PCSC SmartCard Reader Driver works as a virtual application transfer the data - ISO7816 APDUs incoming from the terminal to the smartcard application and back to terminal application response apdu from the smartcard application.
Definitions:
Terminal application, virtual PCSC reader and SmartCard application.
1. Terminal Application
Calling the PCSC Reader’s standard interfaces to operate the PCSC smartcard reader, which does not control the virtual reader driver directly, but the WINDOW PCSC API.
2. Virtual PCSC Reader
Serving as a driver for windows (XP) providing the PCSC Reader for the terminal applications.
3. SmartCard Application
This is the end user application using the virtual PCSC reader driver, which can be a smartcard operating system or a specific application.
Installation:
When the Virtual PCSC driver (VirtualReader.sys and VirtualReader.inf) are installed on the Windows PC, the Virtual PCSC reader will be registered just as any hardware PCSC smartcard readers. The PC device manager will give a PCSC smart card reader along with the haredware reader under Smart card reader group as depicted below – Virtual PCSC SmartCard Reader.
<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />
How to use it:
Terminal application can retrieve the virtual PCSC reader from windows PCSC API named Kefei Virtual Card 0. And we can control the virtual PCSC reader by our terminal application via any PCSC APIs the same with the hardware reader. In other words, we do not know which is the real hardware or virtual PCSC readers as they are just the same.
Procedure:
It is very simple and happy to use it by our smartcard application.
Terminal application call the standard PCSC smartcard reader via the virtual PCSC reader, and virtual PCSC reader transfer the terminal application’s data to the smartcard application which deal with the virtual reader’s several call back functions, and when smartcard application response APDU to the terminal application via the virtual reader driver.
Functions:
Only two functions should be called back from the virtual PCSC driver – InsertCard and RemoveCard.
#ifndef __VIRTUALREADER_H__
#define __VIRTUALREADER_H__
typedef int (WINAPI *pFuncPowerOn)(unsigned char* atr, unsigned int* atrLen);
typedef int (WINAPI *pFuncPowerOff)(void);
typedef int (WINAPI *pFuncTransmit)(const unsigned char* cApduData,
const unsigned int cApduDataLen,
unsigned char* rApduData,
unsigned int * rApduDataLen);
#ifdef __cplusplus
extern "C" {
#endif
int InsertCard( pFuncPowerOn fCallBackPowerOn , // Callback PowerOn
pFuncPowerOff fCallBackPowerOff , // Callback PowerOff
pFuncTransmit fCallBackTransmit ); // Callback Transmit
int RemoveCard(void);
#ifdef __cplusplus
}
#endif
#endif //__VIRTUALREADER_H__
InsertCard – Start up the virtual PCSC reader
Virtual PCSC driver tell the WINODWS that there is a card in this reader. And we are ready to deal with the call back data from the reader caller, power on, power off and transmit.
RemoveCard – Stop the virtual PCSC reader
Inform the virtual PCSC Reader that we do not need your help any more. Then virtual PCSC driver will tell the WINODWS NO card in this reader.
l pFuncPowerOn
Smartcard application implements this function to give the ATR to the terminal application as well as be informed to power on event by the terminal application.
l pFuncPowerOff
Terminal application requests a power off event to the smartcard application.
l pFuncTransmit
Terminal application and smartcard application use this call back function to exchange the ISO7816 APDUs.
Example:
Here is a example about how is the virtual PCSC reader working.
SmartPCSC is a application calling the virtual PCSC reader, who can get the terminal application
It has the functions below,
- Getting the command APDUs from the terminal application,
- Sending the incoming APDU to the real smartcard in another smartcard reader (hardware PCSC reader) and back the terminal application responsing APDU from the smartcard in the hardware PCSC reader.
- Logging the terminal application and the other hardware PCSC reader’s smartcard layout data.
Field of Application:
- Development or Debugging the SmartCard application,
- Logging the PC terminal application and the smartcard transfer data,
- Modify the incoming or outgoing data to the smartcard or from smartcard to meet some tough development condition,
- Analysis the existing smartcard system’s work routine or make a replacement to part of the smartcard system,
- Remote SmartReader, which can call the remote smartcard via TCP
文章评论(0条评论)
登录后参与讨论