Ticket #162 (new defect)

Opened 14 months ago

broken handling of keys in sub-DFs

Reported by: PierreOssman Owned by: opensc-devel@…
Priority: normal Milestone:
Component: opensc Version: 0.11.2
Severity: major Keywords:
Cc:

Description

There is some mishandling of keys stored a few DF:s down on the card, causing PKCS#11 applications to be unable to use them.

The following call chain fails:

C_Login(<pin2>) C_SignInit(<obj2>) C_Sign()

It fails on C_Sign() with the problem that <obj2> is locked and thus unavailable for signing.

The reason for this issue is that <pin2> is 3F00/5015/5016 and <obj2> is 3F00/5015/5016/4B02. What happens is:

init:

3F00/5015 gets selected, as the base of a PKCS#15 card.

C_Login():

card is locked. 3F00/5015/5016 is selected and VERIFY:ed. card is unlocked.

C_Sign():

card is locked. As 3F00/5015 is stored as the current file, opensc selects this DF which in turn causes the card to drop authentication for 3F00/5015/5016. 3F00/5015/5016/4B02 is used for signing, which fails since it is no longer authenticated. card is unlocked.

I'm not familiar enough with the specs to determine how to solve this, I can just determine that something is broken right now.

(enabling lock_login does of course solve the issue since that eliminates the selection of the wrong DF in C_Sign())

Note: See TracTickets for help on using tickets.