智能卡中的逻辑通道

好用户

下面的图片是输出pcsc_scanUbuntu的,当你在看ATR分析,我java卡支持3逻辑信道。

在此处输入图片说明

这是ISO 7816-4的一部分,提到CLA中的低半字节,指示逻辑通道号:

在此处输入图片说明

问题是:为什么当我想通过除基本逻辑通道之外的另一个逻辑通道发送INITIAL-UPDATE APDU命令时,它失败了?

使用CLA = 80[基本逻辑通道]进行初始更新

< 80 50 00 00 08 00
< 00 00 00 00 00 00 00 00
> 611C

< 00 C0 00 00 00 1C 
> 00 11 60 01 03 8A 79 0A F9 FF 02 00 35 F3 92 EC 2B 6F F5 10 2E BD 74 41 2F 25 B4
> 90 00

使用CLA = 81 or 82[补充逻辑通道]进行初始更新

< 81 50 00 00 08 00
< 00 00 00 00 00 00 00 00
> 6881

< 82 50 00 00 08 00
< 00 00 00 00 00 00 00 00
> 6881

As you see, I received SW = 6881, [= Logical channel not supported]. why?


Update :

"If a javacard has two/three logical channel, that mean we can select two/three applet in simultaneously", And is this right? if yes, what is other benefits of having more than one channel? if no, what is this channels for?

Maarten Bodewes

It rather depends on the interpretation of ISO 7816-4 how this is handled. ISO 7816-4 specifies very little about the internal state of smart cards. It is certainly sufficiently vague to leave this specific issue open to interpretation.

Now normally you can have multiple logical channels by using the MANAGE CHANNEL (INS = 70h) APDU. You cannot simply switch over to another channel by specifying the bits in the CLA byte; the channel needs to be open first. Furthermore, it isn't said that the authentication or file system state is taken over by the new channel.

You should see the logical channel as an option to run multiple applications at the same time, where the logical channels are used to interleave commands over the single (half-duplex) communication channel. This is useful if you have different services requiring smart card communication on your terminal (PC).

Obviously logical channels have big drawbacks; you need to keep state for each logical channel. Possibly, you may need to mix state as well (i.e. a PIN VERIFY may be used for both channels). This is very specifically an issue with regards to transient memory (RAM) usage.

Normally you see only cards with 2 logical channels. Most of the time, only one of them will be used. 99% of the time it is better to only allow exclusive access to a single service, and let the smart card services run in sequence. Note that many cards now run at 30 MHz or over, but still have only 8 KiB of RAM in total.

您可以尝试使用MANAGE CHANNEL,但可能是您的ATR对您说谎,并且并非所有应用程序都支持逻辑通道(例如Global Platform Card Manager)。还要注意,Global Platform使用专有的APDU命令/响应(在CLA中设置的最高位= 80h),因此正式而言,您仅需要参考Global Platform规范。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章