Hi all: In our development on OpenDNIe[1] We've writen a "dnie-tool" to get extra, non pkcs15 related card info.
Martin proposed me to use eidenv tool as common tool to display these extra data, and if requested setup environment for calling an external application. Studing eidenv code and how I did it in opendnie, I suggest a change to make eidenv.c card independent, and rely in each card driver the work of get (when available) proper results: 1- Create a new generic cardctl call SC_CARDCTL_GET_EXTRADATA 2- In iso7816.c declare a default cardctl function (pseudocode, sorry) static int iso7816_card_ctl( card, request, data ) { if ( request = SC_CARDCTL_GET_EXTRADATA ) return SC_SUCCESS; return SC_ERROR_NOT_SUPPORTED; } (This function is not even strictly needed, but... ) 3- Define an structure like: struct sc_extra_data { char *name /* alias name to look for */ char *description /* printable string on program output */ char *env_name /* name of the resulting environment var */ char *value /* resulting value, or NULL if not available */ int requested /* true if card driver should provide this var */ } 4- in eidenv.c declare an sc_extra_data array that will be passed to card driver as argument to cardctl call: sc_extra_data data [] = { { "name", "Surname", "OPENSC_SURNAME", NULL,0 } { "givenname1","Given Name 1", "OPENSC_GIVEN_NAME1, NULL,0 } {....} { NULL,NULL,NULL,0 } } 5- In each card driver, the code will fill all available variables, and let NULL the ones that can't handle, returning proper error code 6- As an extra bonus, eidenv could include two commands --list to list all available variables, and --get=name1,name2... to extract only requested variables Pros - unifies access to extra -non-pkcs15-related card data - Doesn't need to modify existing drivers that provides no extra info Contras - Needs a consensus on variable list,names and so - Needs to be written (easy, but someone has to do the job) What do you thing on these approach? Before writing the patch, I'd like hear you some suggestions Juan Antonio _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel