/webscard

A smartcard WSGI proxy

Primary LanguagePython

WebSCard

Overview

This is a web application acting as a universal smartcard proxy : it provides a web interface to a smartcard, together with detailled logs about the communication passing by.

One of the goals is to allow testing of software which necessitate a smartcard from a computer without a readers.

It is meant to support different implementations of smartcards:

  • Software emulations of javacards applets (via pycsc and pythoncard for instance)
  • or real smartcards (via pyscard in this case).

Application

WSGI Application

You can run it as a standalone Python cherrypy server, or as werkzeug server, or embed it inside apache / IIS / Lighttpd / nginx / ...

I recommend cherrypy for stable deployment (unless you already have a web server running) and werkzeug for development, werkzeug debugger is really worth mentioning, serving you a python shell at every level of the stacktrace in your browser.

Qt status bar launcher

An idea I took from the Hatta wiki, you can have a status bar icon to configure, launch, stop, ... WebSCard.

NT Service

The application can also be configured as NT service, in this case, cherrypy will handle the requests.

Lua client

For the sake of testing, a lua client is included. It depends on luacurl. Source is in luaclient/client.lua.

Features

  • It is session aware.
  • It logs everything in a DB
  • It can be configured.
  • It supports multiple implementations.
  • It supports Bonjour
  • It supports SOAP

Dependencies

WebSCard depends on the following packages:

  • Python: Tested on 2.5 and 2.6. Take it from your distribution (cygwin won't play well if you want to play with real hardware as there is not PCSC bridge available)
  • Werkzeug: The network layer is done by werkzeug
  • pyscard: This is an optional dependency if you don't want to play with real hardware.
  • SQLAlchemy: This is how the DB stuff is done.
  • elementTree: For XML parsing for SOAP.
  • Jinja2: For HTML templating.

Note

As pyscard requires compiling/swiging, ... I recommand installing it system-wide with the download from sourceforge.

Howto install the dependencies:

You have three solutions:

  1. Create a virtualenv and install everything in there.
  2. Clone locally the repositories, and symlink/copy (depending on your platform) their package root directory in the WebSCard root directory such that an import X from WebSCard source code works fine.
  3. Install system-wide