Working in new code for DNIe card, I've found a problem:
sc_transmit_apdu() must be overriden to allow secure messaging
routine perform apdu wrapping when SM is on

I've coded a kind of "virtual channel" that hides SM issues from
my code. Every sc_transmit_apdu() call is translated into 
dnie_transmit_apdu() that depending on sm status, encodes apdu
an then redirects to real sc_transmit_apdu()

Victor's SM trunk does something similar, but at lower level
http://www.opensc-project.org/opensc/browser/branches/vtarasov/opensc-sm.trunk/src/libopensc/apdu.c
( Victor's code takes also care on apdu chainning when required, but
that's not my case )

The problem arises when using standard iso7816 functions. For instance
dnie_card_select_file() fully complains standard, so I'd like to use
iso_ops->select_file().... but code at iso7816.c just call
sc_transmit_apdu()... and SM wrapper won't be called. 
The only (and dirty) solution is clone iso_select_file() into my code

An ideal solution for me (and for the other people that is working with
SM cards) would be adding a new card operation "card_transmit_apdu()",
that defaults in iso7816.c to sc_transmit_apdu(), but can be overriden
when needed.
Most card drivers can stay unchanged (bypassing wrapper), but iso7816.c
should be rewritten to take care on redirection

What's your opinion on this?. I can send you required patch for
supporting card_operations->card_transmit_apdu() code

Juan Antonio

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to