|
Locking a card allows an application to perform a multi-APDU transaction (that is, multiple calls to SCF_Card_exchangeAPDU(3SMARTCARD)) without interference from
other smartcard applications. The lock is enforced by the server, so that other applications that attempt to call SCF_Card_exchangeAPDU() or SCF_Card_reset(3SMARTCARD)
will be denied access to the card. Applications should restrict use of locks only to brief critical sections. Otherwise it becomes difficult for multiple applications to share the same card.
When a lock is granted to a specific SCF_Card_t card object, only that object can be used to access the card and subsquently release the lock. If a misbehaving application holds a lock for an extended period, the lock can be broken by having the user remove and reinsert the smartcard.
It is an error to attempt to lock a card when the caller already holds a lock on the card (that is, calling SCF_Card_lock() twice in a succession). Unlocking a card that is not locked (or was already unlocked) can be performed without causing an error.
An application might find that it is unable to lock the card, or communicate with it because SCF_Card_exchangeAPDU() keeps returning SCF_STATUS_CARDLOCKED. If this situation persists, it might indicate that another application has not released its lock on
the card. The user is able to forcably break a lock by removing the card and reinserting it, after which the application must call SCF_Terminal_getCard(3SMARTCARD) to
access the "new" card. In this situation an application should retry for a reasonable period of time, and then alert the user that the operation could not be completed because the card is in use by another application and that removing or reinserting the card will resolve the problem.
|