Benoit Ferson wrote:
> Hi,
> 
> Sorry in advance for some of my questions that may sound irrelevant ; 
> I'm a newbie...
> 
> Here is the context : I am trying to add support to opensc for an applet 
> hosted on a javacard. The applet currently answers to my APDUs 
> correctly, using pcsc-lite. I take inspiration from the card-muscle.c 
> module to implement the required functions of my applet in opensc (say 
> in "card-mycard.c"). As a beginning, I would just like my card to sign 
> some data after the user has successfully authentified himself with the 
> card. I use the pkcs11-tool to test my implementation. I have already 
> added the required stuff for the applet to be recognized by opensc and 
> to start the applet in the early stages of the communication between the 
> computer and the card (i.e., in the match_card() function).
> 
> Here is the problem I am facing : it seems like the initial 
> C_Initialize() function of opensc leads to the invocation of 
> mycard_select_file() function, during the enumeration of "frameworks", 
> the first of which is related to pkcs15 (as seen in pkcs11/slot.c). That 
> call to sc_select_file triggers the following error :

OpenSC and its PKCS#11 code is assuming the card has a PKCS#15 file structure
Its sounds like you card does not. The PIV card is very similar to yours as
it has an applet but no file structure. It emulates a PKCS#15 file structure
to present its objects so they work with PKCS#11 or PKCS#15.  There are a
number of other cards too, they each have a pkcs15-<card>.c file.  The are
listed in the pkcs15-syn.c in the builtin_emulators[] table, with
their sc_pkcs15emu_<card>_init_ex entry points.

> 
> sc_pkcs15_bind_internal: unable to enumerate apps: Not supported
> 
> First, I do not understand why the invocation of the PKCS11 
> C_Initialize() function requires a call to mycard_select_file(). More 
> important, the applet requires the user to be authentified *before* any 
> operation is requested, including the enumeration of the files stored on 
> the card. 
> 
> So, my question is : what is the best way for me to deal with that 
> problem? Should I bypass the call to select_file() during C_Initialize 
> (and how should I implement this)? Should I return something special to 
> that call? Something else?
> 
> One last question : is there some kind of a howto to add support for a 
> new smartcard to opensc?
> 
> Thanks in advance for your help,
> 
> Best regards,
> 
> Ben
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> opensc-devel mailing list
> [email protected]
> http://www.opensc-project.org/mailman/listinfo/opensc-devel

-- 

  Douglas E. Engert  <[email protected]>
  Argonne National Laboratory
  9700 South Cass Avenue
  Argonne, Illinois  60439
  (630) 252-5444
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to