Programming
Home Up Basics Complex

Programming Smart Cards

The manufacturer of the programmer usually provides PC/SC and CT-API drivers so that they can maintain a proprietary role in its usage.

Obviously, programming a smart card is not the same as programming a desktop computer. It has no keyboard or screen, for a start. So how does a smart card receive its input and communicate its output? It talks to the outside world through its bi-directional I/O contact. Communication takes place at 9600 baud or more, according to the T=0 and T=1 protocols defined in ISO/IEC standards 7816-3 and 7816-4.

Application Programming Interface (API)

A common application programming interface (API) can significantly reduce cost and time-to-market when developing new smart card applications, by standardizing the connection between the chip hardware and the operating system allowing smart card application developers to port their software to different hardware platforms.

The API comprises a set of device drivers that provide a convenient interface to all hardware-specific peripherals of the smart card microcontroller including those for crypto co-processors, timers, serial UART interfaces, random number generators and memory management units.

APDU - Application Protocol Data Unit

The APDU (Application Protocol Data Unit) is the communication unit between a reader and a card. The structure of an APDU is defined by the ISO 7816 standards. The APDU is an application level protocol as specified in the ISO 7816-4, which takes place between a smart card and a host application for the purpose of communicating between each.

There are two categories of APDUs: command APDUs and response APDUs. As the name implies, the former is sent by the reader to the card: it contains a mandatory 5-byte header and from 0 to up to 255 bytes of data. The latter is sent by the card to the reader: it contains a mandatory 2-byte status word and from 0 to up to 256 bytes of data.

Javacard Framework Class APDU

Command and Response APDU Structures

WinSCard APDU View Utility - This DLL allows you to intercept all APDUs sent and received from the WinNT5 PC/SC smartcard subsystem.

BasicCard Developers Programming Kit - 59 Euros - BasicCard® from Zeitcontrol in Germany is the first smart card programmable in BASIC. It is supposedly easy to use, open to anyone, requires no special training - if you were born a genius - and is competitively priced. Using the BasicCard® anyone can program their own smart cards but don't plan on it happening overnight. I read the manual and got the standard brain freeze that comes from not having a least a 10% understanding factor.

BASIC was originally developed when computers had no resources. That is exactly the same problem what we have today with smart cards. So programmers needed a language suited to the limited computing resources - and here BASIC fits perfect. When you also take into account the limitations of smart card microprocessors, BASIC becomes the smart choice. Sure, there are fancier programming languages, but when you are trying to program a smart card, anything else is just show business.

In the end, the most important difference between a BasicCard® and a Java® or MultOS®card is not the programming language - it's the price. And the formula here is simple: the bigger the smart card chip, the higher the price. Java® and MultOS® are resource-hungry, to run a simple application they need expensive smart card chips (i.e. 1 kByte RAM, 64 kByte ROM and 32 kByte E²Prom). Using the Enhanced BasicCard (256 bytes RAM, 17 kByte ROM and 8 kByte E²Prom) costs 1/3 as much.

Follow the examples or write your own application. When you are done, use the BasicCard compiler to convert your application to P-Code and load it to the E²Prom of your BasicCard. You have just programmed your first smart card.

BasicCard setup instructions and download from VCT.

OpenSC project - core library of the OpenSC project and library for accessing SmartCard devices.

Basic functionality (e.g. SELECT FILE, READ BINARY) should work on any ISO 7816-4 compatible SmartCard. Encryption and decryption using private keys on the SmartCard is possible with PKCS #15 compatible cards, such as the FINEID (Finnish Electronic IDentity) card.

It offer basic functionality like talking to smart cards, but also advanced functions like generating RSA keys on a smart card.

The base platforms are Linux and MacOS X; some parts have been ported to Windows.

OpenCT is a new framework for accessing smart cards, card readers and card terminals. It was written from scratch, already includes all drivers, and is very lightweight. OpenCT is available for Linux, but if you want to use it on other Unix or BSD operating systems, please ask for help on the opensc-devel mailing list. OpenCT is a middleware framework for smart card terminals.

OpenCT is open source software. As such it is available with full source code for free. OpenCT is a software companion to OpenSC and the preferred way of accessing smart cards under Linux. OpenCT is available from the OpenSC website www.opensc.org/

Cryptographic Service Provider #11 : A Microsoft CryptoAPI Cryptographic Service Provider binding to the PKCS #11 API

GnuPG: The GNU Privacy Guard - GnuPG.org

M.U.S.C.L.E. project: Linux Smart Card Development - Movement for the Use of Smart Cards in a Linux Environment

OpenCA: OpenSource Certification Authority Toolkit

OpenSignature: Tools and GUI for digital signature (presently only in Italian)

OpenSSL: The Open Source toolkit for SSL/TLS

OpenSSH: A free SSH/SecSH protocol suite providing encryption for network services like remote login or remote file transfer.

Smart Sign: Software for smartcard based digital signature and both local and remote authentication security services.

strongSwan: An OpenSource IPsec implementation for the Linux operating system.

PCSC Smart Card Application Development Delphi components. The components give an easy access to PCSC resources, hiding the details of the underlying API, allowing for rapid PCSC application development.

Contains Delphi components implementing smartcard functionality in PCSC standard. The components enable the programmer to easily create complex applications communicating with smartcard by using the services brought by Smartcard Resource Manager.

APDU Demo - Application which can be used to send APDU commands to a card. The answer to each command is displayed along with a description of the return code. Lists of commands can be created to group commands specific to different types of card.

This application has been created to demonstrate how easy it is to create a fully functional smartcard applications using the PCSC Delphi components presented on this website.

Transmission Protocol Data Units ( TPDU )

Transmission Protocol Data Units (TPDUs): transport protocols used for the transmission of APDUs and the data structure that is exchanged by the host and a card.

Smart Card File Systems


 
Google
Web www.smartcardscanada.com