Comment JavaCard and MUSCLE (Score 2, Informative) 14
A previous poster mentioned the MUSCLE project. It provides lots of open-source software for talking to smartcards, primarily for cryptographic applications.
MUSCLE works with JavaCards . With these it is relateively easy to write your own applets that run on the card and do whatever you want.
Lots of vendors supply JavaCard-compliant cards. For example, SchlumbergerSema, iButton, and Gemplus.