smartcard - OPSystem.setATRHistBytes 如何在 GlobalPlatform 兼容卡中工作?
问题描述
引用自 GP2.1.1 API 文档:
setATRHistBytes
public static boolean setATRHistBytes(byte[] baBuffer,
short sOffset,
byte bLength)
This method sets the historical bytes of the ATR (Answer To Reset) string. The sequence of bytes will be visible on a subsequent power-up or reset.
Notes:
This method shall not be invoked from the Applet.install() method.
The OPEN locates the entry of the current applet context in the Open Platform Registry and verifies that the application has the "default selected" privilege.
The OPEN is responsible for updating the length of historical bytes in Format Character T0 of the ATR.
Parameters:
baBuffer - the source byte array containing the ATR historical bytes. Must be a global array.
sOffset - offset of the ATR historical bytes within source byte array.
bLength - the number of historical bytes.
Returns:
true if ATR bytes set, false otherwise.
问题 1:GP 是否强制默认选择小程序来更改 ATR Hist 字节?
问题 2:GP 是否仅更改 Cold Reset ATR?还是暖重置 ATR 也发生了变化?
问题 3:我如何才能收到我的卡的热重置 ATR?有什么命令吗?它是特定于读者的吗?
解决方案
关于1:我以前从未使用过此命令,但是在阅读时:
OPEN 在 GlobalPlatform Registry 中定位当前小应用程序上下文的条目,并验证应用程序是否具有默认选定权限。
我会假设任何兼容的实现都必须以这种方式处理它。是否有理由不相信这一点,或者您是否问大多数供应商是否忽略了这一点?由于历史部分包含与默认选择的应用程序相关的信息(例如,卡有 MF、如何读取 EF.DR、默认应用程序的 AID、发行人所在的国家/地区……),因此检查此权限是有意义的。这在今天可能不适用于多应用智能卡世界。
关于 2:正如名称“历史字节”所示,仅更改了ATR的这一部分。时钟速度等其他部分在冷 ATR 和暖 ATR 之间可能有所不同。
关于 3:查看 PC/SC 命令SCardConnect
。见SCARD_RESET_CARD
和SCARD_UNPOWER_CARD
。
推荐阅读
- android - Cordova 应用程序仅在分屏视图/多个应用程序视图中显示
- mysql - 如何使用游标根据另一列更新某些列?
- c - 如何将 char** 转换为 Vec
生锈 - ruby-on-rails - 多个字段 sort_by 组合的 reverse 和 not
- reactjs - 异步更新 mobx 反应钩子上的存储
- javascript - 当用户有一段时间没有登录应用程序时发送电子邮件
- excel - 参考 VBA 从工作簿中运行宏,其名称在单元格区域中指定 & 隐藏模块错误中的编译错误
- angular - 如何使用 rxJS 使用表单控件对来自服务器的可观察加载数据执行过滤?
- python - 两个数组的交集,其中包含完全相反的元素顺序
- clish - 拒绝 clish 命令的字符串参数中的 sql 查询