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>