Question about multiple applications

Bob Backlund <[email protected]> Wed, 19 Dec 2018 11:06:07 +0800
Newsgroups gmane.comp.encryption.opensc.devel
Message-ID <CAC+xjZp4mBVYNiVKBr-mussY9aDuh4J_C6oH5P5bo8FchHYmww@mail.gmail.com>
Hi,

Just some question about how the OpenSC PKCS# 11 (DLL) handles the multiple
applications using it.

The scenario is I have two applications, application A and application B
loading the same DLL.

Application B loops continuously, calling C_WaitForSlotEvent and
C_GetTokenInfo, basically it just checks for the insert and remove events
from the smart card.

Application A can call C_InitPIN and C_InitToken.

The conflict happens when, while the application B is checking for smart
card events, application A then calls C_InitToken, which deletes the smart
card contents, and formats it to be a new card, (and possibly deleting the
PKCS# 15 objects) and the next call to C_OpenSession fails returning
CKR_TOKEN_NOT_PRESENT error.

When I try to check the logs, the state of the smart card become ABSENT , I
can see this during the C_InitToken, when sc_detect_card_presence is called.

When I try to run application A, and call C_InitToken without the
application B running, I do not encounter this issue, and the smart card
does not become ABSENT but instead I can see from the logs that its state
become CHANGED.

I am not sure if this is the expected behavior or where or how I should
handle it. I am not sure if this is also an issue on the OpenSC PKCS# 11
DLL or the smart card. I tried to look at the available documentation but
couldn't find an answer to this,

Your expert opinion is greatly appreciated.


Thanks,

fightingsibuyas

_______________________________________________
Opensc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensc-devel