Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 1.92 KB

Adding-a-new-card-driver.textile

File metadata and controls

27 lines (18 loc) · 1.92 KB

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

Windows `minidriver` support

Microsoft Windows probes the Smart Card security drivers and loads it related features thanks to the ATRs that should registered (see regedit) from the minidriver framework. You should carefully register the ATRs using the OpenSC installer customization based on the following rules:

pbAtrMask: Optional bitmask to use when comparing the ATRs of smart cards to the ATR supplied in pbAtr. If this value is non-NULL, it must point to a string of bytes the same length as the ATR string supplied in pbAtr. When a given ATR string A is compared to the ATR supplied in pbAtr, it matches if and only if A & M = pbAtr, where M is the supplied mask, and & represents bitwise AND.

Examples

  • [[New card driver: EnterSafe card example]]