From: Douglas E E. <dee...@gm...> - 2018-03-07 22:55:13
|
First of all if this is a new card, you will need the vendor or applet documentation on what ISO-7816-4 commands the card supports. Search internet for iso 7816-4 you can buy the ISO documentation or find some online versions. Does the card have a PKCS#15 file structure? OpenSC was originally written to support PKCS#15 cards. The sort of hierarchy or APIs is: PKCS#11 routines framework-pkcs15.c sc_pkcs15_* routines pkcs15_mycardanme.c routines sc_routines card_mycardname.c routines iso7816.c sc routines at APDU level reader drivers PCSC is the main one. On 3/7/2018 1:35 PM, Robert via Opensc-devel wrote: > > Still haven't gotten a good answer yet. But figured I would share what I am starting to understand about OpenSC as I look at and push up some new questions > > And a different question, instead of documentation on adding a new card, is the a book perhaps that would be worth reading? I have worked on the application side of PKCS15 but never had to deal with > this side. The card vendor documentation on the card edge commands. These are the ISO-7816-4 commands supported by the card and any card specific commands. > > Anyways my understanding to add in a new card type is to create a pkcs15-mycardname.c and corresponding card-mycardname.c file and basically fill in functionality for the following bits below. The pkcs15-mycardanme.c can emulate a PKCS15 file structure for a card by creating pkcs15 objects from whjatever the card can support. (I am most familiar with this type of card.) > > It also looks like I can create a test tool based on opensc-tool (noticed several other cards have done the same thing just renamed it). pkcs11-tool uses PKCS#11 API to talk to any PKCS#11 module including the opensc-pkcs11.so pkcs11-tool calls sc_pkcs15_* routines opensc-tool calls the sc_* routines at the card driver level and below. Other tools have operations for doing additional card specific operations. > > > For card-*.c > > add in an the following function: > > /static struct sc_card_driver * sc_get_driver()/ – Object like C reference for functions to use on the card. From here we add in custom functions for each item in the sc_card_driver structure. You will also need create the match_card and init routines. You can also supply a list of ATRs for for you card do the matching in teh match_card routine. > > IS there anything that gives definitions as to what each function is expected to do? The pretty match the ISO-7816-4 commands. > > > For pkcs15-*.c > > Add in the following function (also add in a hook to either opensc.conf or pkcs15-syn.h – This bit is pretty confusing to me. It “looks like” this function is used as an initialization for a series of > objects. But I can't find documentation or figure out how those objects play with the rest of OpenSC. > > Does this sound about right? Is there any guides worth looking at or something that is written about all the objects that you assign functions to in these two modules? Yes. (Have to go now.) > > > FuzzyH > > > > > On Wednesday, January 17, 2018, 8:39:04 AM EST, Robert <fuz...@ya...> wrote: > > > All, > > Just wanted to know if my assumption to add in a new card to OpenSC is correct. > > I have been a longtime user of pcsc-lite but never had to dive into it myself. Well I got asked if I could look into implementing a card if I was given the ADPU spec for the card. > > If I am reading everything correctly from the pages below I just need to add in support to OpenSC and make sure I put in the proper ATR's for the cards. > > Is that correct? Or am I missing an important part where I need to add in something to the pkcs11 layer as well. Also what about some of the debug tools like opensc-tool, would they need to be > modified? Or do they pull what they need from the OpenSC card driver? > > > Robert > > > > https://github.com/OpenSC/OpenSC/wiki/Quick-Start-with-OpenSC > > https://github.com/OpenSC/OpenSC/wiki/Adding-a-new-card-driver > > https://github.com/OpenSC/OpenSC/wiki/New-card-driver:-EnterSafe-card-example > > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > _______________________________________________ > Opensc-devel mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/opensc-devel > -- Douglas E. Engert <DEE...@gm...> |