Giter VIP home page Giter VIP logo

pcscdotnet's Introduction

PcscDotNet

.NET standard library for accessing PC/SC (Personal Computer/Smart Card) functions.

This library provides the generic way for accessing PC/SC functions, you can write your specific provider with IPcscProvider interface implementation.


Projects


Introduction

The implementations of PC/SC enumerations and structures and the declarations of PC/SC methods, both are referenced from Windows Kit, MSDN and pcsc-lite.

The main interfaces/classes:

This interface declares the members that need to be implemented for accessing PC/SC functions.

These are the methods declared with the same name of PC/SC functions currently:

  • SCardBeginTransaction
  • SCardCancel
  • SCardConnect
  • SCardControl
  • SCardDisconnect
  • SCardEndTransaction
  • SCardEstablishContext
  • SCardFreeMemory
  • SCardGetStatusChange
  • SCardIsValidContext
  • SCardListReaderGroups
  • SCardListReaders
  • SCardReconnect
  • SCardReleaseContext
  • SCardTransmit

Other methods:

  • AllocateIORequest

    Allocates managed byte array which mapped to unmanaged SCARD_IO_REQUEST structure.

  • AllocateReaderStates

    Allocates managed byte array which mapped to unmanaged array of SCARD_READERSTATE structure.

  • AllocateString

    Allocates string in managed or unmanaged memory.

  • FreeString

    Releases the unmanaged memory which allocated by AllocateString.

  • ReadIORequest

    Reads values from SCARD_IO_REQUEST which allocated by AllocateIORequest method.

  • ReadReaderState

    Reads values from the specific index of the SCARD_READERSTATE array which allocated by AllocateReaderStates method.

  • SCardCtlCode

    Gets reader action I/O control codes.

  • WriteIORequest

    Writes values to SCARD_IO_REQUEST which allocated by AllocateIORequest method.

  • WriteReaderState

    Writes values to the specific index of the SCARD_READERSTATE array which allocated by AllocateReaderStates method.

If you want to implement your provider using WinSCard or pcsc-lite, see the table below, it shows the different definitions between platforms:

Unmanaged Defined * WinSCard (Windows) pcsc-lite (OS X) pcsc-lite (Linux)
SCARD_CTL_CODE(code) Define 0x00310000 | (code << 2) 0x42000000 + code 0x42000000 + code
ANSI Characters Encoding System Locale UTF-8 UTF-8
Unicode Characters Encoding Unicode - -
SCARD_READERSTATE Pack - 1 -
DWORD Size 4 4 sizeof(void*)
LONG Size 4 4 sizeof(void*)
SCARD_READERSTATE.rgbAtr Size 36 33 33
SCARD_PROTOCOL_RAW Value 0x00010000 0x04 0x04

This class is the start point for accessing PC/SC functions. You need to specify IPcscProvider instance to create Pcsc instance.

This class provides the static members with corresponding members in Pcsc class, using singleton instance of TIPcscProvider which implements IPcscProvider interface.

Most of time, TIPcscProvider can be used with singleton safely unless its members may be changed, e.g., the provider loads functions from different library dynamically.

This class implements IPcscProvider using WinSCard.dll of Windows environment (Unicode).


Archie Yang

pcscdotnet's People

Contributors

archie-yang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.