Javacard - 垃圾收集期间断电 [英] Javacard - power loss during garbage collection

查看:26
本文介绍了Javacard - 垃圾收集期间断电的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到我的智能卡(带有 Omnikey 5121 读卡器的 NXP J2E145、J3A081、J3C145)上出现了一些非常奇怪的行为:调用 JavaCard 方法后立即断电

I noticed some very strange behaviour on my smartcards (NXP J2E145, J3A081, J3C145 with an Omnikey 5121 reader): A power loss right after calling JavaCard method

JCSystem.requestObjectDeletion()

可能会损坏卡:在大约 10% 的此类断电后,ATR 命令非常慢(1000 毫秒)并且我对任何其他 APDU(小程序选择、卡管理器身份验证等)都没有响应.

can damage the card: after about 10% of such power cuts the ATR command is very slow (1000ms) and I get no response to any other APDUs (applet selection, card manager authentication etc.).

我知道 requestObjectDeletion() 的行为取决于供应商特定的实现,所以我的问题非常广泛和开放......

I know that the behavior of requestObjectDeletion() depends on the vendor specific implementation, so my question is quite wide and open...

垃圾收集是否通常"在单个事务中处理?

Is garbage collecting processed "usually" in a single transaction?

是否有任何官方"建议不要在可能断电的情况下调用 requestObjectDeletion()?

Is there any "official" recommendation NOT to call requestObjectDeletion() in case of a possible power loss?

您对 NXP 的卡片有类似的体验吗?

Do you have any similar experience with cards by NXP?

  • JCSystem.isObjectDeletionSupported() == true 在我所有的智能卡上.
  • 尝试连接损坏卡的卡管理器小程序时,Eclipse IDE 中的 JCOP shell 会报告:

  • JCSystem.isObjectDeletionSupported() == true on all my smartcards.
  • When trying to connect to the card manager applet of a damaged card, the JCOP shell in Eclipse IDE reports this:

ATR:3BFB9600008131FE454F4450204D41502053414D3E

ATR: 3BFB9600008131FE454F4450204D41502053414D3E

ATR:T = 1
jcshell:终端的未知问题.上一个终端错误:由于 I/O 设备错误,无法执行请求.

ATR: T = 1
jcshell: Unknown problems with terminal. Last terminal error: The request could not be performed because of an I/O device error.

推荐答案

我认为这可能是一个实现错误.一般而言,智能卡从不需要或不使用垃圾收集.

I think this may be an implementation bug. In general, garbage collection is never needed nor used on smart cards.

在任何情况下,您都应该通过良好的小程序设计避免垃圾收集.这样你就永远不会遇到内存问题.小程序通常在其生命周期内仅安装一次,并且应该在卡的其余生命周期内可用.

You should avoid Garbage Collection under any circumstances by good applet design. That way you should never run into memory problems. Applets are commonly installed only once in their lifetime and should be usable for the rest of the life-cycle of the card.

对于正常用例,垃圾收集通常需要很长时间.也许这就是 Java Card 或底层系统库的程序员没想到它发生在安全环境之外的原因.

Garbage Collection generally takes too long for normal use cases. Maybe that is why the programmer of the Java Card or underlying system libraries didn't expect it to happen outside a secure environment.

这篇关于Javacard - 垃圾收集期间断电的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆