pcsc-lite  1.8.26
MUSCLE PC/SC-Lite API Documentation


This document contains the reference API calls for communicating to the MUSCLE PC/SC Smart Card Resource Manager. PC/SC is a standard proposed by the PC/SC workgroup http://www.pcscworkgroup.com/ which is a conglomerate of representative from major smart card manufacturers and other companies. This specification tries to abstract the smart card layer into a high level API so that smart cards and their readers can be accessed in a homogeneous fashion.

This toolkit was written in ANSI C that can be used with most compilers and does NOT use complex and large data structures such as vectors, etc. The C API emulates the winscard API that is used on the Windows platform. It is contained in the library libpcsclite.so that is linked to your application.

I would really like to hear from you. If you have any feedback either on this documentation or on the MUSCLE project please feel free to email me at: corco.nosp@m.ran@.nosp@m.muscl.nosp@m.ecar.nosp@m.d.com.


These routines specified here are winscard.h routines like those in the winscard API provided under Windows(R). These are compatible with the Microsoft(R) API calls. This list of calls is mainly an abstraction of readers. It gives a common API for communication to most readers in a homogeneous fashion.

Since all functions can produce a wide array of errors, please refer to pcsclite.h for a list of error returns.

For a human readable representation of an error the function pcsc_stringify_error() is declared in pcsclite.h. This function is not available on Microsoft(R) winscard API and is pcsc-lite specific.


PC/SC Lite is formed by a server deamon (pcscd) and a client library (libpcsclite.so) that communicate via IPC.

The file winscard_clnt.c in the client-side exposes the API for applications.
The file winscard.c has the server-side counterpart functions present in winscard_clnt.c.
The file winscard_msg.c is the communication interface between winscard_clnt.c and winscard.c.
The file pcscdaemon.c has the main server-side function, including a loop for accepting client requests.
The file winscard_svc.c has the functions called by pcscdaemon.c to serve clients requests.

When a function from winscard_clnt.c is called by a client application, it calls a function in winscard_msg.c to send the message to pcscdaemon.c. When pcscdaemon.c a client detects a request arrived, it calls winscard_svc.c which identifies what command the message contains and requests winscard.c to execute the command.
Meanwhile winscard_clnt.c waits for the response until a timeout occurs.