Blog moved to

I moved my blog from to . Why? I wanted to move away from Blogger (owne...

Wednesday, November 28, 2012

New version of pcsc-lite: 1.8.7

I just released a new version of pcsc-lite 1.8.7.

pcsc-lite-1.8.7: Ludovic Rousseau
28 November 2012
  • Fix a problem when a reader is unplugged (and the reader is still in use)

Friday, November 23, 2012

New UI design for the online ATR parser

I made some graphical design (using CSS) for my Smart card ATR parsing online application.

I am not a web designer (you may have noticed). But I tried to make the interface nicer.

The new interface looks like:

If you want to work on a better design you are welcome. Contact me.

Related articles:

Friday, November 2, 2012

PCSC sample in lua

To continue the list of PC/SC wrapper initiated more than two years ago with "PC/SC sample in different languages" I now present a PC/SC sample in lua.

In a previous blog article "cardpeek: A tool to read the contents of smartcards" I presented an application using the lua language to interact with smart cards.

PC/SC access from lua

Cardpeek is a complete application and not a PC/SC wrapper. The cardpeek author implemented only what was needed for the application instead of a general PC/SC wrapper.

The card functions available from lua are:
  • connect
  • disconnect
  • warm_reset
  • last_atr
  • info
  • send
  • set_command_interval
  • make_file_path

One important missing function is an equivalent of SCardListReaders(). The list of available readers and selection of the reader to use is not available from the lua code. The reader selection is done by the cardpeek application using C code directly.

Some work is missing in order to have a complete PC/SC wrapper for lua.

Source code

function hex_tostring(data)
 local r = ""
 local i
 for i=0,#data-1 do
  r = r .. string.char(data[i]) 
 return r

if card.connect() then

 -- Select applet
 select =, "00 A4 04 00 0A A0 00 00 00 62 03 01 0C 06 01")
 sw, resp = card.send(select)
 print(string.format("SW: %X", sw))

 -- Send command
 command =, "00 00 00 00")
 sw, resp = card.send(command)
 print(string.format("SW: %X", sw))



The output is sent to the console using the lua print() statement. You could also send the output to cardpeek using log.print() instead.


In the console

SW: 9000

SW: 9000
Hello world!

In cardpeek


I reported some improvements for cardpeek (issues 13, 14, 15 and 16). One month after, the issues are still open and the proposed patches not applied or reviewed. A bad news concerning the state of the cardpeek project :-(.

This pseudo-wrapper is the 12th wrapper for PC/SC. What will be the next language?