Some questions about SELECT APDU command in Javacards

若如初见. 提交于 2019-12-04 14:08:58

Q0 (update): If a SELECT by NAME is received for a that does not select the current applet then:

  • if another Applet is selected then only the deselect method is called
  • if no other Applet is selected then only the process method is called

Q1: No. The system will still handle all the SELECT by NAME APDU's before it forwards it to the Applet process method. So another Applet can be selected before the SELECT is send to the currently selected applet, and the newly selected Applet will receive the APDU instead.

Note that the system will even re-select the current Applet if a SELECT by NAME is received with the current Applet's AID (so all memory and objects that are cleared on deselect will be cleared, and the select and deselect methods will be called).

Note that later API's (Chen's book is still applicable, but aging a bit) have added a method to check if the APDU was used to select the current Applet. This is also useful to check how it was selected, which primarily is useful if the Applet is also selected by default, i.e. before any APDU was received.

Q2: No, currently not. This is tricky functionality that will have firewall and security implications. So this would not be a minor update to the Java Card standard. It comes up quite a lot on the forums though. You may access other applets through the firewall of course.

Q3: There are indeed no background tasks. Adding multi-threading would completely break the API of Java Card Classic Edition, so it will never be added. To share information both Applets must be explicitly designed to do so, and the firewall rules will be in effect.

Q0: If a SELECT by NAME is received JCRE will check if AID specified in APDU partialEquals() any AID registered by JCRE. If there is no such AID registered by JCRE, the SELECT by NAME APDU will be sent to the currently selected applet. If such AID is registered by JCRE, no matter what applet is currently selected, the currently selected applet will be deselected (invoking deselect()) and the applet with matching AID will be selected (calling select() and passing selectingApplet()=True to process()).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!