我有一个应用程序,其重置权限是重置后默认选择的应用程序。
我的应用程序有一个日志记录机制,可以准确地告知对卡发出的请求。根据当前状态,我有几个动态响应。我还用卡 spy 检查了行为。
所有 APDU 都正确转发到我的应用程序,包括那些不属于它且与卡上任何其他应用程序都不匹配的 SELECT。
但是,当收到 SELECT DF Next Occurrence (A4 04 02) 时,不会发生这种情况。相反,卡返回以下 SW:6A85-条件不满足。
现在..我明白该卡可能在做什么,即检查当前是否选择了指定了相同 AID 的应用程序,并尝试选择下一个具有相同 id 的应用程序。 (事实并非如此。卡上没有冲突的 AID)。
我的问题是:如果没有安装匹配的应用程序,卡操作系统是否应该不转发此 APDU?这是在已选择应用程序的情况下进行选择的假定行为。
另一个问题:有没有办法修复/规避此问题,或者您认为这可能是操作系统错误?或者根本不是这样的?
示例:
Card Reset
-> 00 A4 04 00 07 AIDx7..
<- My Applet 90 00
-> 00 A4 04 02 07 AIDx7...
<- Card 6A 85
Moves on to other selects
My applet is still selected.
我使用的是 NXP JCOP3 卡。
提前致谢。
最佳答案
引用GlobalPlatform Card Specification Version 2.3 ,第 68 页:
6.4.2.1.2 Explicit Selection on Basic Logical Channel
...跳过了一些段落...
Runtime Behavior
The following requirements apply to the OPEN in the explicit Application selection (SELECT [by name]) process on the Basic Logical Channel (This behavior does not apply if the card Life Cycle State is TERMINATED):
...跳过了几个案例....
If no full or partial match is found at all, the currently selected Application on the Basic Logical Channel shall remain the selected Application and
If the SELECT [by name] command has the [first or only occurrence] parameter set, the SELECT command is dispatched to the Application.
If the SELECT [by name] command has the [next occurrence] parameter set, the OPEN shall return the appropriate error to the off-card entity.
这与您描述的行为完全匹配(需要说明的是,您的 JCOP 可能受某些早期版本的 GlobalPlatform 卡规范的约束)。
对于第二个问题:
我敢打赌,使用您的特定卡没有半简单的方法来修复/规避此问题。
还有其他卡的工作方式有所不同 - 使用哪一种卡取决于您的用例。
祝你好运!
关于smartcard - Applet 未收到下次出现的 JavaCard SELECT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49039326/