Reputation: 1198
As far as I know, to open/close a logical channel we must use MANAGE CHANNEL
APDU command.
- Open a logical channel :
00 70 00 P1 P2 LE
- Close a logical channel :
00 70 80 P1 P2 LE
- P1-P2 =
0000
-0003
- LE=
01
(if P1-P2=0000
) or Empty (if P1-P2!=0000
)
. And the only open logical channel by default is Basic channel.
The question:
1-Why when I send SELECT APDU through a close logical channel, it opens automatically?
2-When we must/need to use open/close logical channel command (MANAGE CHANNEL)?
This is output of Opensc-tool, and as you see, I successfully send and receive SELECT and GET RESPONSE commands and responses, through logical channel 1 and 2, without opening them before :
Logical channel 1:
C:\>cd E:\OpenSC\tools
E:\OpenSC\tools>opensc-tool -s 01A40400 -s 01C0000012
Using reader with a card: ACS CCID USB Reader 0
Sending: 01 A4 04 00
Received (SW1=0x90, SW2=0x00)
Sending: 01 C0 00 00 12
Received (SW1=0x90, SW2=0x00):
6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65 o..............e
01 FF ..
Logical channel 2:
E:\OpenSC\tools>opensc-tool -s 02A40400 -s 02C0000012
Using reader with a card: ACS CCID USB Reader 0
Sending: 02 A4 04 00
Received (SW1=0x90, SW2=0x00)
Sending: 02 C0 00 00 12
Received (SW1=0x90, SW2=0x00):
6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65 o..............e
01 FF ..
E:\OpenSC\tools>
Upvotes: 2
Views: 3375
Reputation: 502
These ISO commands goes directly to ISD and according to Global Platform, ISD is default selected on all available logical channels.
Upvotes: 2
Reputation: 5333
SELECT is defined to be an alternative for opening a logical channel since ISO 7816-4 version of 1995. No other command beyond the mentioned MANAGE CHANNEL is able to do so. The management information for a logical channel typically consumes significant resources (e. g. RAM for the acquired access rights, session keys, current security environment). As soon you as get errors pointing in that direction (somewhat plausibe are 6A 84 meaning no more memory in file, 65 81 memory error, but in any case your card documentation has precedence here) you should haved closed it before. Typically there is good reason to use a logical channel and it derives from the use case when it is no longer needed.
Upvotes: 3