wiki:DeveloperInformation/NewCardDriver

Adding a new card driver

Basic tasks to hook up a new driver to the OpenSC framework:

  • create card-example.c (based on the structure of some existing driver)
  • add "example" to the list of internal_card_drivers in ctx.c
  • add extern sc_card_driver_t *sc_get_example_driver(void); to cards.h
  • add card-example.c to the end of the lists in Makefile.am and Makefile.mak
  • re-create autotools scripts: ./bootstrap

Creating the skeleton card driver

  • Identify any card revisions, to be included in ATR map etc. Add to the end of enum list in cards.h (+1000 base)

PKCS#15 driver hookup

  • PKCS#15 card formats should need minimal or no modifcations, to allow sc_pkcs15_bind to scan the card and populate in-memory structures
  • Non-PKCS#15 cards need to create a pkcs15-example.c, hook it to builtin_emulators in pkcs15-syn.c and add to Makefiles list.
  • pkcs15-example.c creates the in-memory structure by linking right objects with their counterparts based on ID codes or whatever information that is necessary